Re: Surprisingly forgiving behavior when a case expression is terminated with "end case"

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Surprisingly forgiving behavior when a case expression is terminated with "end case"
Дата
Msg-id 6aa4cba7-6d45-fc05-219c-72632b4b423f@aklaver.com
обсуждение исходный текст
Ответ на Surprisingly forgiving behavior when a case expression is terminated with "end case"  (Bryn Llewellyn <bryn@yugabyte.com>)
Список pgsql-general
On 8/10/22 11:59, Bryn Llewellyn wrote:
> The account of the CASE expression here:
> 
> https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-CASE 
> <https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-CASE>
> 
> says that it's terminated with the keyword END (just as I've always 
> understood)—i.e. not with the PL/pgSQL CASE statement's  END CASE.
> 
> Moreover CASE is a reserved word—as a "create table case(…)" attempt 
> shows. Yet CASE is tolerated (using PG 14.4) here:
> 
> *select 1 as case;
> *
> In fact, any reserved word that I try (like IF, THEN, and so on) is 
> accepted as an alias. This seems to me to be wrong. What do you (all) think?

But documented:

https://www.postgresql.org/docs/current/sql-keywords-appendix.html

" Even reserved key words are not completely reserved in PostgreSQL, but 
can be used as column labels (for example, SELECT 55 AS CHECK, even 
though CHECK is a reserved key word)."


-- 
Adrian Klaver
adrian.klaver@aklaver.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Surprisingly forgiving behavior when a case expression is terminated with "end case"
Следующее
От: André Hänsel
Дата:
Сообщение: Why is DEFAULT much faster than UPDATE?