Re: [PATCH v1] psql: Do not complete JSON format for COPY FROM

From: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
To: "pgpool-hackers(at)lists(dot)postgresql(dot)org" <pgpool-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH v1] psql: Do not complete JSON format for COPY FROM
Date: 2026-11-04 01:27:13
Message-ID: OS9P286MB698308C1744929AE8B67C8A4AF94682@OS9P286MB698308.JPNP286.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

Hi,

My previous emails were mistakenly sent to this mailing list.
Please disregard them.

Please disregard them. Sorry for the noise.

Regards,

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

________________________________
差出人: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
送信日時: 2026年11月4日 10:16
宛先: pgpool-hackers(at)lists(dot)postgresql(dot)org <pgpool-hackers(at)lists(dot)postgresql(dot)org>
CC: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
件名: [PATCH v1] psql: Do not complete JSON format for COPY FROM

Hi,

I noticed that psql's tab completion suggests the JSON format for both
directions of COPY.

For example:

COPY t1 FROM STDIN WITH (FORMAT <TAB><TAB>
binary csv json text

However, the documentation says that the JSON format is allowed only
for COPY TO. If a user selects the suggested "json" candidate, the
command fails:

COPY t1 FROM STDIN WITH (FORMAT JSON);
ERROR: COPY FORMAT JSON is not supported for COPY FROM

I think it is misleading for tab completion to suggest syntax that is
explicitly unsupported by the documentation and rejected by the
server.

The attached patch checks the COPY direction and offers "json" only
for COPY TO. This applies to both COPY and \copy completion.

There is already a separate discussion proposing support for COPY FROM
with FORMAT json [1]. If that support is committed, the completion can
of course be extended at the same time. However, in the current tree
COPY FROM does not support JSON, so I think tab completion should
reflect the currently implemented and documented behavior.

[1]
https://www.postgresql.org/message-id/CAEG8a3%2BwxMXGLcnrDzSF0qTDzH%2BK7_x0FWNAcu-H_j8gKiwFVw%40mail.gmail.com

Regards,
Taiki Koshino

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

In response to

Browse pgpool-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-11-10 06:27:03 Re: Segfault when a watchdog sync changes the primary under running children
Previous Message Koshino Taiki 2026-11-04 01:16:47 [PATCH v1] psql: Do not complete JSON format for COPY FROM