From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Francisco J(dot) Ossandón <fco(dot)j(dot)ossandon(at)gmail(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, 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: | 2024-08-29 00:11:28 |
Message-ID: | 3501446.1724890288@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
=?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 | Francisco J. Ossandón | 2024-08-29 00:33:34 | Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE |
Previous Message | Francisco J. Ossandón | 2024-08-29 00:02:50 | Re: BUG #18594: CASE WHEN ELSE failing to return the expected output when the same colum is used in WHEN and ELSE |