Roland Roberts <roland@astrofoto.org> writes:
> if (exists select id from deepsky where catalog = NEW.catalog and entry = NEW.entry and suffix is null
andcomponent is null) then
> postgresql doesn't like the "if (exists select id from ...)".
Should be "if (exists (select ...))". Note the parens in SQL92:
<exists predicate> ::= EXISTS <table subquery>
<table subquery> ::= <subquery>
<subquery> ::= <left paren> <query expression> <right paren>
regards, tom lane