Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE - Mailing list pgsql-bugs

From Vik Fearing
Subject Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE
Date
Msg-id b980ef30-29ce-4dec-b5cd-64e961bec3b0@postgresfriends.org
Whole thread Raw
In response to Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE  (Chris BSomething <xpusostomos@gmail.com>)
List 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




pgsql-bugs by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Re: BUG #18817: Security Bug Report: Plaintext Password Exposure in Logs
Next
From: "Jose Fco. Mojada"
Date:
Subject: Re: Possible bug ¿? missing "ucol.h" in postgre installation