Re: if exists select ... in plpgsql code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: if exists select ... in plpgsql code
Дата
Msg-id 24876.1031719067@sss.pgh.pa.us
обсуждение исходный текст
Ответ на if exists select ... in plpgsql code  (Roland Roberts <roland@astrofoto.org>)
Ответы Re: if exists select ... in plpgsql code  (Roland Roberts <roland@astrofoto.org>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Roland Roberts
Дата:
Сообщение: if exists select ... in plpgsql code
Следующее
От: tony
Дата:
Сообщение: OT: amazon problem