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.96) (envelope-from ) id 1w2s1c-000gVg-27 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 14:37:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2s1b-00BZkh-1a for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 14:37:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2s1b-00BZkZ-0h for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 14:37:31 +0000 Received: from dverite2024.planet-service.net ([185.16.44.252] helo=mail.verite.pro) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2s1X-00000000NBF-23kg for pgsql-hackers@postgresql.org; Wed, 18 Mar 2026 14:37:30 +0000 Received: by mail.verite.pro (Postfix, from userid 1000) id EC3A82C84C4; Wed, 18 Mar 2026 15:37:25 +0100 (CET) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Emitting JSON to file using COPY TO From: "Daniel Verite" To: "Andrew Dunstan" Cc: Masahiko Sawada , Jian He , Joe Conway , Junwang Zhao , Florents Tselai , Andrey M. Borodin , Dean Rasheed , Davin Shearer , PostgreSQL development In-Reply-To: <964a3377-d957-4a06-ad02-8228aefa65fc@dunslane.net> Date: Wed, 18 Mar 2026 15:37:23 +0100 Message-Id: X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan wrote: > Here's a v30 set that I hope fixes these issues. Currently there's no difference in output between the null json value and the SQL null. postgres=3D# create table tbl (j jsonb); CREATE TABLE postgres=3D# insert into tbl values('null'); INSERT 0 1 postgres=3D# insert into tbl values(null); INSERT 0 1 postgres=3D# table tbl; j=20=20=20 ------ null =20 (2 rows) postgres=3D# copy tbl to stdout with (format json); {"j":null} {"j":null} If we had to reload this file, we could not determine which kind of null we had even though they are different at the SQL level: postgres=3D# select null::jsonb is distinct from 'null'::jsonb; ?column?=20 ---------- t Does it have to be that way or are there valid distinct outputs that we could use to avoid this ambiguity? Best regards, --=20 Daniel V=E9rit=E9=20 https://postgresql.verite.pro/