public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniel Gustafsson <[email protected]>
To: Chao Li <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: COPY JSON: use trailing commas in FORCE_ARRAY output
Date: Wed, 6 May 2026 10:23:53 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

> On 6 May 2026, at 08:40, Chao Li <[email protected]> wrote:

> I was surprised by the comma placement. It is valid JSON, but it looks quite uncommon.

It might look uncommon, but for very wide lines it's IMHO preferrable to not
have to scroll all the way to the end of the line to know that the line is part
of an array.

> For comparison, the existing json_agg() places commas at the end of the line:

That's true, but json_agg() and COPY TO in ndjson format have different use
cases.

> ..it should not have any performance impact.

It does add branches though, and in one branch use a non-inlined function where
previously it would unconditionally use an inline function.  ISTM it would
still be valuable to do performance testing given that COPY is commonly used in
performance sensitive settings.

--
Daniel Gustafsson






view thread (6+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: COPY JSON: use trailing commas in FORCE_ARRAY output
  In-Reply-To: <[email protected]>

* 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