| From: | Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com> |
|---|---|
| To: | Amit Langote <amitlangote09(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 303677365(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, e1638616(at)u(dot)nus(dot)edu |
| Subject: | Re: BUG #19851: Adding a tautological CHECK(true) to a domain changes JSON_VALUE's result (silent NULL, value/type c |
| Date: | 2026-12-03 13:50:12 |
| Message-ID: | CA+Y2BmfCnuKG0G-TqC38VmwyCWAZbHB=w64Mxqpbbw4H0iMfsg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Amit,
BUG #19971 [1] came in yesterday and is close to this one. I checked
it against v1, and it still reproduces:
SELECT JSON_VALUE(jsonb '{}', '$.a' RETURNING json
DEFAULT '"123"'::jsonb ON EMPTY);
It returns the number 123 instead of the string "123", and a '"abc"'
DEFAULT fails. ON ERROR and a domain over jsonb behave the same way.
The ON EMPTY and ON ERROR coercions still get omit_quotes, which is
always true for JSON_VALUE(). With v1 that flag no longer affects the
path result, only the DEFAULT. The path result keeps its quotes when
the RETURNING base type is json or jsonb, so I think the DEFAULT
should as well.
My #19825 patch [2] fixes the same path-result case with a narrower
change, and also this DEFAULT case. Yours fixes the cause, so I'll
withdraw mine from the commitfest. Its DEFAULT tests can be reused if
they help.
[1] https://www.postgresql.org/message-id/19971-5a844714bd6f89f8%40postgresql.org
[2] https://www.postgresql.org/message-id/CA%2BY2Bmcrp%2BaKua4nxip-nY17t4nhwHQxEr9Js_pvRnckBgH%2BYA%40mail.gmail.com
Regards,
Ishjaap Singh
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Daniel Gustafsson | 2026-12-03 13:03:25 | Re: BUG #19702: decode() accepts Base64 payload after terminal padding |