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 1vnJT2-004zri-2I for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Feb 2026 16:41: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 1vnJT1-006JCr-1L for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Feb 2026 16:41:31 +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.96) (envelope-from ) id 1vnJT1-006JCg-0H for pgsql-hackers@lists.postgresql.org; Tue, 03 Feb 2026 16:41:30 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vnJSy-00000000rn6-1BWT for pgsql-hackers@postgresql.org; Tue, 03 Feb 2026 16:41:30 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-b884ad1026cso968491866b.2 for ; Tue, 03 Feb 2026 08:41:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770136887; cv=none; d=google.com; s=arc-20240605; b=iUSAbHI2/3e5sj6cb4EUrRL0+pd7WWyG3OzrwxH/uQ4KfnOAR8rfOwiFI8E+qeDdbF 5r70WdgDUyKlqCLOWWvVwqJ1+XOIJ84WFOevkUzfAfhuJeMUaENv8FKfDJiLxHUgpSxl 1FciTbgF23osEj7ITsvq0VOjr/wAHvx82vjqU67smg/5keHPjfJRs3ZaUEcAX3sOf31y HLloEJ2/ETGxLql/jh6vQrkRcruILod0J8NBQ47PIGwIIun39+vGlCPeGeZY+T+q7q7j OqADvDJW4zmg64jr7TRv6RQ7eobk4z4T8VDDjxljqRnFr2ExVsMJHQA1680PWJmX7MsR j3wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=xJZvnGiZ3/0LydRMW9cZDzsqxQFKQ8V6IYplUDdleRw=; fh=y8JeP6Y3pggrmffGTCYZYWlOEhX2Y9X8YQby3VLmARY=; b=CSg6n2VfWs4LiONFhngnjU9EuGLz9frrhIQF2Kmu2bTgJzd1s9/OmoNb5lAE7YMRTP VFjsO/17zMFL43DcW33lqf0Rb15CxiJC3NgwzL2Fpf6xBxrRvfKvZTXf6dHhrjsekKQU YIxbo8OXJ2nz10AbjEp4KrkKN4vX2pKeQ64f5GsRWmL+mV4oQghIB47yANnWSv3cG95R ijS75H5npQMdUpeWrEnil5JRN0H65AP8IiON474o1ULmdqVLptvogWhTTXESu/FwDFxu HL6rg89b1WOCEVuC+Ow5NiM7MjlCsXkSdAd9fIgx+fqugai1zb669yEPuEtvx97Tptc5 t3Nw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770136887; x=1770741687; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=xJZvnGiZ3/0LydRMW9cZDzsqxQFKQ8V6IYplUDdleRw=; b=luWtgBqPeNExcB1gJCGAYjyBJnye/ZgHwkvb9PattJIdV8tKQ7kyj+45AFWTN3VmM4 w0iXkqogopNeKaGSiualq+5l9aSxR6TXWVt4fUo3zMXHDJzjEGSPL1y2GD61KEh++HZL XKuNJ9AfPZgMRGHouLxoyUVEngzHkPPeAcuvIkPFqRlopJZByNNUGa3eQ/TnS/AyoBPW s15iupugdl4LeWsOLXVZ9oMWYdbskV7OeOpc+XgW1cDX54kgeE5szoEZm28tUhPAnL2f GbvNR7Mp7ihm2G+anWMF3XzPl6vPByKIFJ/Tb6pBZlATtXbgcOBBydId/VKZDrfeFLvZ KlCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770136887; x=1770741687; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xJZvnGiZ3/0LydRMW9cZDzsqxQFKQ8V6IYplUDdleRw=; b=XFo/2aYksSPpvQ70+4VlFhOyE8hs4+RPWLDIFGCDNR/HG7eeVB35nyTRnSDTm0nAcE QU2Lq8vCheOIimAQMlHIgMPrhG6KW/t8W8w7X1yz+Uc5C0xtnZsPw90r5bU3M7E6Wpq4 naL07dWFz2FSY18zodIvStIl7+2swBSS0hbLibR516soWV/SscELXEthAdx4WCmDWH4J EOU176GcD0pdjokJocEsTh8rj5oZ2p+7G4UGstHQ3g4OIMtcP7QgBXnbxIEhj/+5dDGs OFMYoOfABykKB9frnluSogfekUqWNg23O40NKqsv0FnVQH7lh32XCKKlSnp+jM2DLZ91 Pw/w== X-Forwarded-Encrypted: i=1; AJvYcCW8RIuuqMQBB7b1qX2p9/owP9utu3rCibrQvIexAhN7RxWNk3J3I0lQ7dyF9We7j0ybT5bGw6eikPEn+2NK@postgresql.org X-Gm-Message-State: AOJu0YxBwOmvRYvXji+pD6h83IfaQVo9smmPBF86wzHQ++fkREp+Wndb ct/4wgqiREEBwNwrOPPKwOdFZLmAgc4gVojPuxwwty9/vJBSuqcTJXzHEUeb+R3oB/lzKCmJzid sIGXrBTnuXEAmwh9qR37sw8VHy4A5/i4= X-Gm-Gg: AZuq6aJCUUNfMuVRf4PZylwI+DGVpqV44v9u/tWZt6ljJVogL5HOsog9ngBQz+5zw1a VXhLnrQItsUWFrmUInh2VFd/3sFKD7rJODCgp57QSu/X2mrGgpZVxjnUYKoDyBGlXYeIxIz+WY4 CR2ZJ8fTaUg5td2IILOpJRjyg3eTZD4fa3iWnsiZLoGPck9CerJMklU1VoOh4t7AB4gI9plIOCL B5Msls8JqmTS/opkJ54wLioGZuYLp6/C7BO7r222VRmFZQvq3hxd7RG4fUjqJi4/wVU69D4Jc9i ujkfzccW2f6UOP/oriBW/bDaL9iAg3u+/g1Dm5aL3slZocSB2h5a5IwovVhgnhS0CnzD98q09hu +6J9XJA== X-Received: by 2002:a17:906:d54b:b0:b87:206a:a241 with SMTP id a640c23a62f3a-b8e9ef26263mr10090066b.11.1770136886943; Tue, 03 Feb 2026 08:41:26 -0800 (PST) MIME-Version: 1.0 References: <8620df11-96e4-4ca3-8f3c-33a479260961@joeconway.com> <4162f7f7-6fd6-4720-98e2-89f80e3de2ed@joeconway.com> <153b71b8-b6fb-4930-aaff-a7334cb3f6d6@joeconway.com> <8ef5f5d6-38db-4624-8eef-2d96c9eba9d4@joeconway.com> In-Reply-To: From: Florents Tselai Date: Tue, 3 Feb 2026 18:40:49 +0200 X-Gm-Features: AZwV_Qicz8bQ28wDCgs6o8jThh60alsLUeCaLp8mKIeMQDwLQLtX6Ka0MxcW6Rk Message-ID: Subject: Re: Emitting JSON to file using COPY TO To: jian he Cc: Junwang Zhao , Joe Conway , "Andrey M. Borodin" , Dean Rasheed , Daniel Verite , Andrew Dunstan , Davin Shearer , PostgreSQL-development Content-Type: multipart/alternative; boundary="00000000000059a40b0649ee1c5c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000059a40b0649ee1c5c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 21, 2026 at 2:16=E2=80=AFPM jian he wrote: > hi. > > rebase only. > > -- > jian > https://www.enterprisedb.com/ I (and others I assume) would really like to see this in 19; glancing at the thread above and in the test cases I see this is in good shape for comitter review. No? If I were to add something it would be an example in copy.sgml When the FORCE_ARRAY option is enabled, the entire output is wrapped in a JSON array and individual rows are separated by commas: COPY (SELECT id, name FROM users) TO STDOUT (FORMAT JSON, FORCE_ARRAY); [ {"id": 1, "name": "Alice"} ,{"id": 2, "name": "Bob"} ,{"id": 3, "name": "Charlie"} ] Also, apologies if that has been discussed already, is there a good reason why didn't we just go with a simple "WRAP_ARRAY" ? --00000000000059a40b0649ee1c5c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable



<= div class=3D"gmail_quote gmail_quote_container">
On Wed, Jan 21, 2026 at 2:16=E2=80=AFPM jian he <jian.universality@gmail.com> wrot= e:
hi.

rebase only.

--
jian
https://www.enterprisedb.com/

I (an= d others I assume) would really like to see this in 19;
glancing = at the thread above and in the test cases I see this is in good shape for c= omitter review.
No?=C2=A0

If I were to a= dd something =C2=A0it would be an example in copy.sgml=C2=A0
=C2= =A0 <para>
=C2=A0 =C2=A0When the <literal>FORCE_ARRAY</li= teral> option is enabled,
=C2=A0 =C2=A0the entire output is wrapped i= n a JSON array and individual rows are separated by commas:
=C2=A0 =C2= =A0<programlisting>
COPY (SELECT id, name FROM users) TO STDOUT (F= ORMAT JSON, FORCE_ARRAY);
=C2=A0 =C2=A0</programlisting>
=C2=A0= =C2=A0<programlisting>
[
{"id": 1, "name":= "Alice"}
,{"id": 2, "name": "Bob&quo= t;}
,{"id": 3, "name": "Charlie"}
]
= =C2=A0 =C2=A0</programlisting>
=C2=A0 </para>
=
Also, apologies if that has been discussed already,
is there a good reason why didn't we just go with a simple "WRAP= _ARRAY" ?=C2=A0

--00000000000059a40b0649ee1c5c--