Re: Surprisingly forgiving behavior when a case expression is terminated with "end case" - Mailing list pgsql-general

From Tom Lane
Subject Re: Surprisingly forgiving behavior when a case expression is terminated with "end case"
Date
Msg-id 370703.1660159073@sss.pgh.pa.us
Whole thread Raw
In response to Surprisingly forgiving behavior when a case expression is terminated with "end case"  (Bryn Llewellyn <bryn@yugabyte.com>)
Responses Re: Surprisingly forgiving behavior when a case expression is terminated with "end case"
List pgsql-general
Bryn Llewellyn <bryn@yugabyte.com> writes:
> 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? 

I think we've spent a great deal of blood, sweat, and tears
making that so, or as nearly so as we could.  We will in
fact take any keyword after "AS", and in recent versions many
non-reserved keywords will work that way without "AS".

(Mind you, I think the SQL spec made a serious design error
in allowing "AS" to be optional.  But we have to live with that
as best we can.)

            regards, tom lane



pgsql-general by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Surprisingly forgiving behavior when a case expression is terminated with "end case"
Next
From: Adrian Klaver
Date:
Subject: Re: Surprisingly forgiving behavior when a case expression is terminated with "end case"