| From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
|---|---|
| To: | QQ Mail <781408517(at)qq(dot)com> |
| Cc: | zengman(at)halodbtech(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19625: SQL/JSON boolean DEFAULT expression silently replaced with 'false' |
| Date: | 2026-11-12 01:23:15 |
| Message-ID: | CA+HiwqGO9i5MUhOnnnXXrvKpou0A99wCfOuXrJcXRvTecmzTTg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
Thanks for the report and the patch.
Attached is v2, which I intend to commit and back-patch to v17. The
main changes from the patch posted on Aug 24 are:
* I kept the existing jsonb Const for JSON_BEHAVIOR_TRUE and
JSON_BEHAVIOR_FALSE, so only a boolean-valued DEFAULT expression gets
wrapped in a to_jsonb() FuncExpr. That way the node tree for TRUE /
FALSE ON ERROR is unchanged in the back branches.
* More tests, including the cases asked for in the review posted on
Oct 12 (NULL::boolean, JSON_QUERY with ON EMPTY, and a non-constant
default).
* Added commit message noting that views and rules created before the
fix still contain the wrong 'false'::jsonb
Bug #19822 reports the same problem and the cases shown there are
fixed by this patch as well, so the commit message mentions that bug #
too.
--
Thanks, Amit Langote
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-SQL-JSON-Fix-boolean-DEFAULT-expressions-in-ON-ER.patch | application/octet-stream | 10.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-11-12 01:25:21 | Re: BUG #19822: DEFAULT boolean expressions in SQL/JSON functions are re-encoded as JSON booleans and always yield f |
| Previous Message | PG Bug reporting form | 2026-11-12 00:49:22 | BUG #19894: CREATE DATABASE logs all-zeros visibility map |