Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Дата
Msg-id CAFj8pRCiZn63UuBoADXWxCVVdFCDvt1jwO6_dQStuaK9NdMJag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect  (David Johnston <polobo@yahoo.com>)
Список pgsql-bugs
Dne 30.10.2013 1:29 "David Johnston" <polobo@yahoo.com> napsal(a):
>
> joshuadburns wrote
> > Every example within the PLPGSQL "control structures" documentation
states
> > that the proper syntax for closing a "CASE" statement is to use "END
> > CASE;"
> > however in reality, on every version of PostgreSQL I can my hands on,
"END
> > CASE;" throws the following exception:
>
> User error, though understandable.
>
> pl/pgsql CASE requires "END CASE", SQL CASE just uses "END"
>
> DO $$
> DECLARE val integer;
> BEGIN
> val := 2;
>
> CASE val
> WHEN 1 THEN RAISE NOTICE 'Got 1';
> WHEN 2 THEN RAISE NOTICE 'Got 2';
> END CASE;
>
> END;
> $$;
>
> Your examples were making use of SQL "CASE" expressions which do not
accept
> "END CASE" but "END".
>
> A pl/pgsql CASE must be the first token of an expression (using the term
> loosely) since its purpose is to act as flow-control.  The sames goes for
> IF.

It is just wrong. Plpgsql statements cannot be nested inside expression.

Plpgsql doesn't know only expression statemenst yet, so first token is
statement reserved keyword ever.

>
> There are a number of constructs and keywords in pl/pgsql that behave
> slightly differently than their counter-parts in pure SQL.
>
> David J.
>
>
>
>
> --
> View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-8568-PLPGSQL-Documentation-For-CASE-Is-incorrect-tp5776314p5776318.html
> Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: BUG #8568: PLPGSQL Documentation For CASE Is incorrect
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #8524: PQsendQueryParams with RETURNING clause on a INSERT