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.