postgresql - Syntax error at or near ; -
i have many trigger functions, , there strange error: "syntax error @ or near ;
" here code:
create or replace function zajisti_vyplnenost() returns trigger $$ begin if new.typ_vztahu != 1 return new; end if; if new.nad.typ_sj = 1 if new.nad.vrstva.vypln = true else raise exception 'totožné stratigrafické jednotky musejí být stejného typu!'; end if; return new; end; $$ language plpgsql; create trigger zajisti_vyplnenost before insert or update on s_vztah each row execute procedure zajisti_vyplnenost();
according debugger, error should on line 14 (with end;
). tried find might cause problem, function looks others don't trigger errors. looked on documentation function , end syntax in plpgsql, no joy, , semicolon makes error quite google unfriendly.
so part of syntax wrong, , how correct it?
looks forgot 1 end if
:
if new.nad.typ_sj = 1 if new.nad.vrstva.vypln = true else raise exception 'totožné stratigrafické jednotky musejí být stejného typu!'; end if; end if;
should correct
Comments
Post a Comment