From: | Leo Volin <lvolin(at)intelligentaudit(dot)com> |
---|---|
To: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Case clause doesn't report syntactic error |
Date: | 2024-09-14 21:27:35 |
Message-ID: | DS0PR14MB71197DD699B2D10236D9059CA1662@DS0PR14MB7119.namprd14.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Dear friends!
I am reporting this behavior when using case clause(let's say interactively):
Version: PostgreSQL 12.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18), 64-bit
Maybe it's fixed(if it needed fixing) going forward.
This generates no error:
select case '4'::int when 1 then 1 when 4 then 11 else 2 end;
(prints 11)
It doesn't match the documented format:
CASE WHEN condition THEN result
[WHEN ...]
[ELSE result]
END
As long as the type of entry between CASE and first WHEN matches type of WHEN conditions no syntax error is being generated!
But the whole CASE maybe isn't operating as expected.
Example of when error is produced:
select case 't' when 1 then 1 else 2 end;
ERROR: operator does not exist: text = integer
LINE 1: select case 't' when 1 then 1 else 2 end;
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
Please tell me if this is an undocumented feature or a bug.
Regards,
Leo Volin
SSA
Intelligent Audit
[breast cancer awareness logo]<https://www.intelligentaudit.com/>
o: (201) 880.1110 ext. 103
w: www.intelligentaudit.com<http://www.intelligentaudit.com/>
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2024-09-14 22:26:07 | Re: Case clause doesn't report syntactic error |
Previous Message | Tom Lane | 2024-09-14 17:07:54 | Re: BUG #18617: PostgreSQL Server Subprocess Crashes by the XPATH Function Expression with Crafted Arguments |