agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: theshallow27@gmail.com
Subject: BUG #19737: Empty `JSON_OBJECT` cannot use documented `ON NULL` or unique-key clauses
Date: Fri, 02 Oct 2026 22:36:20 +0000
Message-ID: <19737-b44cf2e08708b613@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19737
Logged by:          Shallow
Email address:      theshallow27@gmail.com
PostgreSQL version: 18.6
Operating system:   Linux
Description:        

The documented syntax makes the key/value pair list optional and says that
an
empty pair list constructs an empty object. However, adding any of the
optional
clauses without a pair causes a syntax error.

**Reproduction:**

```sql
SELECT JSON_OBJECT();                 -- returns {}
SELECT JSON_OBJECT(NULL ON NULL);     -- syntax error, SQLSTATE 42601
SELECT JSON_OBJECT(ABSENT ON NULL);   -- syntax error, SQLSTATE 42601
SELECT JSON_OBJECT(WITH UNIQUE KEYS); -- syntax error, SQLSTATE 42601
```

**Expected result:** Each form with an empty pair list should construct
`{}`;
the clauses do not change the result when there are no pairs.








Message-ID: <19737-b44cf2e08708b613@postgresql.org>
Permalink:  ../19737-b44cf2e08708b613@postgresql.org/
Also on:    postgresql.org/message-id/19737-b44cf2e08708b613@postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, theshallow27@gmail.com
  Subject: Re: BUG #19737: Empty `JSON_OBJECT` cannot use documented `ON NULL` or unique-key clauses
  In-Reply-To: <19737-b44cf2e08708b613@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox