pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vik Fearing <vik@postgresfriends.org>
To: Chris BSomething <xpusostomos@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: PostgreSQL Bug List <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE
Date: Wed, 19 Feb 2025 20:02:34 +0100
Message-ID: <b980ef30-29ce-4dec-b5cd-64e961bec3b0@postgresfriends.org> (raw)
In-Reply-To: <CADrHaBFq+gK8DVpbvh-M2LVuvLu1JHz_rkKXirWCwNDZBhUUFg@mail.gmail.com>
References: <18594-af265c6988d431d8@postgresql.org>
	<0838f16a-8b3d-4c39-9ad8-5d27791e9dec@dunslane.net>
	<CAEgp-NfU3G_9ynpY4n0hUvYjW2eLLqmGJ5_ejtS5hPi131Jg5g@mail.gmail.com>
	<3501446.1724890288@sss.pgh.pa.us>
	<CADrHaBGKd4DQZpEWsdU3msCjg+z1dy1RkFbUn39pm+QuD0QMGQ@mail.gmail.com>
	<CAKFQuwZ2Rk4T+NWM6uLbooEmg9ADUPb9MqBvqFceK_c2+RyKBQ@mail.gmail.com>
	<1149960.1739844738@sss.pgh.pa.us>
	<CADrHaBFq+gK8DVpbvh-M2LVuvLu1JHz_rkKXirWCwNDZBhUUFg@mail.gmail.com>


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






view thread (14+ messages)

Message-ID: <b980ef30-29ce-4dec-b5cd-64e961bec3b0@postgresfriends.org>
Permalink:  ../b980ef30-29ce-4dec-b5cd-64e961bec3b0@postgresfriends.org/
Also on:    postgresql.org/message-id/b980ef30-29ce-4dec-b5cd-64e961bec3b0@postgresfriends.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: vik@postgresfriends.org, xpusostomos@gmail.com, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE
  In-Reply-To: <b980ef30-29ce-4dec-b5cd-64e961bec3b0@postgresfriends.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox