Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE
Vik Fearing <vik@postgresfriends.org>
From: Vik Fearing <vik@postgresfriends.org>
To: Chris BSomething <xpusostomos@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>,
PostgreSQL Bug List <pgsql-bugs@lists.postgresql.org>
Date: 2025-02-19T19:02:34Z
Lists: pgsql-bugs
On 19/02/2025 13:50, Chris BSomething wrote: > > On Tue, 18 Feb 2025 at 10:12, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > I think such a rule would be pretty dangerous, even if we could > implement it easily. As an example, if you entered something you > meant as a timestamp, but you fat-fingered the punctuation or > something, it'd likely fall back to being considered just "text", > > > I don't get that, I thought timestamps have to be preceded by "TIMESTAMP". The SQL standard requires you to do that, but PostgreSQL is a bit more lax about it (and in my humble opinion, thankfully so). If you did prefix your literals with their type, you wouldn't be having these problems in the first place. The problem stems from postgres treating your unmarked literal as "unknown" and then trying to figure out what the heck it is. -- Vik Fearing