Re: [PATCH] Reject ENCODING option for COPY TO FORMAT JSON - Mailing list pgsql-hackers

From Ayush Tiwari
Subject Re: [PATCH] Reject ENCODING option for COPY TO FORMAT JSON
Date
Msg-id CAJTYsWU94ZRstTmJUB_CmempGnWc_Q9P6hV8mpr-Ym6G-Ck_bg@mail.gmail.com
Whole thread
In response to Re: [PATCH] Reject ENCODING option for COPY TO FORMAT JSON  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
Hi,

On Mon, 20 Apr 2026 at 13:56, Daniel Gustafsson <daniel@yesql.se> wrote:
> On 20 Apr 2026, at 08:06, Ayush Tiwari <ayushtiwari.slg01@gmail.com> wrote:

> The attached patch rejects the explicit ENCODING option for JSON
> mode, consistent with how DELIMITER, NULL, DEFAULT, and HEADER are
> already rejected.

Given that we reject other incompatible parameters it makes sense to reject
this one as well, however I think we can expand the comment a little and
explain why.


Thanks Daniel. Agreed, v2 attached with an expanded comment
explaining why the option is rejected, I've tried to make it small, because rest
rejected ones did not have relevant comments.

  /*
   * Reject ENCODING for JSON format.  JSON output is produced as
   * a whole by composite_to_json(), so the per-attribute encoding
   * conversion done for text and CSV output is not applied.
   */

Regards,
Ayush

Attachment

pgsql-hackers by date:

Previous
From: Yuchen Li
Date:
Subject: Re: EXCEPT TABLE - Case inconsistency for describe \d and \dRp+
Next
From: Lakshmi N
Date:
Subject: Fix pg_upgrade to detect invalid logical replication slots on PG19