Re: [PATCH] Reject ENCODING option for COPY TO FORMAT JSON

Ayush Tiwari <ayushtiwari.slg01@gmail.com>

From: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Andrew Dunstan <andrew@dunslane.net>
Date: 2026-04-20T08:54:47Z
Lists: pgsql-hackers

Attachments

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

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Apply encoding conversion in COPY TO FORMAT JSON