From: | Chris BSomething <xpusostomos(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Bug List <pgsql-bugs(at)lists(dot)postgresql(dot)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: | 2025-01-22 10:00:04 |
Message-ID: | CADrHaBGKd4DQZpEWsdU3msCjg+z1dy1RkFbUn39pm+QuD0QMGQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
In the 6 rules for type resolution, rule 5 says "select the first
non-unknown input type as candidate, and consider if other non-unknown
types can be implicitly converted." ... should there not be a new rule,
something like considering if the unknown types can be converted, then
notice that a long string can't be converted to a char, because it won't
fit? And then fail with an interesting error?
On Thu, 29 Aug 2024 at 08:11, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> =?UTF-8?Q?Francisco_J=2E_Ossand=C3=B3n?= <fco(dot)j(dot)ossandon(at)gmail(dot)com>
> writes:
> > So is the ELSE column hijacking the data type of the whole expression?
>
> It's the only CASE result that is supplying a definite type at all.
> But see
>
> https://www.postgresql.org/docs/current/typeconv-union-case.html
>
> particularly the footnote to the bit about "Select the first
> non-unknown input type as the candidate type, then consider
> each other non-unknown input type, left to right."
>
> The WHEN clauses have exactly nothing to do with the result type
> of the CASE: it's the THEN and ELSE clauses that supply the result.
>
> regards, tom lane
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Rajni Bobal | 2025-01-22 15:54:56 | Re: BUG #18774: Not the required output of the query used in the function(delete_from_table1) in postgresql9.4 |
Previous Message | Даниил Элишаков | 2025-01-22 08:28:53 | Re: BUG #18779: Segmentation fault while trying to connect via psql |