Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xD75n-00000000K4t-1Wc8 for pgsql-bugs@arkaria.postgresql.org; Sat, 03 Oct 2026 21:16:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xD75m-000000039U9-0TVa for pgsql-bugs@arkaria.postgresql.org; Sat, 03 Oct 2026 21:16:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xClsK-00000001TyA-3EfL for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:37:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xClsH-000000006Vp-1SNu for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:37:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=r0tpbDKVcI282K92QdNcwDG7BdoIqt5YSqQJyorSjUY=; b=hxmL7C4KqWdVv4RbjVWcsqqIW1 WfbHm69WUhUmgUjrQbemuCIC34CAv2YGP4UAvfGmdzdbNaYWmPGmNrUx7KfSfi9D/PSBrO6pXCIjN l5sE8TB+PLowPZqrEhOqB126/3+Tbpyf6ojR8zsP4Ronihr4gIlQ5GS9+4qgZi3GSSqaCWyH/g3ii 8RjYsuhuYfC/TYIcxKPaRIEeRkIQlD7osEP7dE/aKgXEia7mhG236h3lWZ+aOKi6Q7V7iNR9hRJQo y86CIAeTqqUhzumYR3dfuse97yqoQun9/YycbcdW/THv60Grg76VPK+0WBVow1ZrAzbqGCVQlxqIv Tmiv1pVw==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xClsG-00000000JAW-0NVh for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:37:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xClsF-00000000sbQ-05Ny for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:37:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19737: Empty `JSON_OBJECT` cannot use documented `ON NULL` or unique-key clauses To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: theshallow27@gmail.com Reply-To: theshallow27@gmail.com, pgsql-bugs@lists.postgresql.org Date: Fri, 02 Oct 2026 22:36:20 +0000 Message-ID: <19737-b44cf2e08708b613@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: =20 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.