Hi,

I noticed that psql's tab completion suggests MATCH as a value of the
HEADER option for both directions of COPY.

For example:

  COPY t1 TO STDOUT WITH (HEADER <TAB><TAB>
  false  MATCH  true

However, the documentation says that HEADER MATCH is valid only for
COPY FROM.  If a user selects the suggested "MATCH" candidate for
COPY TO, the command fails:

  COPY t1 TO STDOUT WITH (HEADER MATCH);
  ERROR:  cannot use "match" with HEADER in COPY TO

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 "MATCH" only
for COPY FROM.  The boolean values remain available in both
directions, and the change applies to both COPY and \copy completion.

Regards,

Taiki Koshino<[email protected]>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

Attachment: v1-0001-psql-Do-not-complete-HEADER-MATCH-for-COPY-TO.patch
Description: v1-0001-psql-Do-not-complete-HEADER-MATCH-for-COPY-TO.patch

Reply via email to