Re: BUG #19737: Empty `JSON_OBJECT` cannot use documented `ON NULL` or unique-key clauses

From: Narayanan Venkateswaran <narayananvpostgres(at)gmail(dot)com>
To: Nitin Motiani <nitinmotiani(at)google(dot)com>
Cc: theshallow27(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: BUG #19737: Empty `JSON_OBJECT` cannot use documented `ON NULL` or unique-key clauses
Date: 2026-11-26 19:23:22
Message-ID: CAFjuD9cYx6t4qchPT1-Tzkggqs_6bLssqTvzqgkb3PXU3T=8ng@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Nitin,

Thanks again for the review. I have attached v4 addressing your
comments:

> 1. Like the commit message, I think we should also update the doc to
> say that this behaviour is an extension beyond the SQL standard.

Updated func-json.sgml for both json_array and json_object to note that
this is an extension to the SQL standard.

> 2. It might be worth adding one empty form to the existing "Test
> JSON_ARRAY deparsing" section in sqljson.sql, since an empty
> JSON_ARRAY with NULL ON NULL now prints a form that wasn't possible
> before.

Added the empty view deparsing test for JSON_ARRAY (and a similar one
for JSON_OBJECT as well), along with a bit of grammar cleanup in gram.y.

All tests pass locally. Please let me know what you think.

Thank you,
Narayanan

Attachment Content-Type Size
v4-0001-Allow-NULL-and-UNIQUE-clauses-in-empty-JSON_OBJEC.patch application/octet-stream 12.8 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kirill Reshke 2026-11-26 20:14:01 Re: BUG #19942: SIGSEGV crash (and wrong results) in MERGE ... RETURNING WITH (OLD/NEW) with VIRTUAL generated colum
Previous Message Tom Lane 2026-11-26 18:56:12 Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs