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