| From: | Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | psql: tab completion offers invalid COPY option values |
| Date: | 2026-10-30 04:40:09 |
| Message-ID: | CAF1DzPXjeGHhpgKzEWmpuoxdZWwErN79yRodOkwRYAt7Bdn2BA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
While browsing the code, found that tab completion for two COPY option
values does not take the COPY direction into account, so it offers values
the server rejects.
1. COPY ... FROM ... WITH (FORMAT <TAB> offers json, but COPY FROM does not
support it:
=# copy t from '/dev/null' with (format json);
ERROR: COPY FORMAT JSON is not supported for COPY FROM
2. COPY ... TO ... WITH (HEADER <TAB> offers MATCH, but it is valid only
for COPY FROM:
=# copy t to '/dev/null' with (header match);
ERROR: cannot use "match" with HEADER in COPY TO
The option-name completion already distinguishes the two directions, using
Copy_from_options and Copy_to_options selected by
HeadMatches("COPY|\\copy", MatchAny, "FROM"). The value completions for
FORMAT and HEADER sit in the same block.
The attached patch applies that same HeadMatches check to the FORMAT and
HEADER rules.
--
Thanks & Regards,
Suraj kharage,
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-psql-Fix-tab-completion-of-COPY-FORMAT-and-HEADER.patch | application/octet-stream | 3.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-10-30 05:09:12 | Re: [PATCH] pgstat: Add helper to drop entries from a stats kind's hash |
| Previous Message | Manu | 2026-10-30 04:03:47 | Re: O(N^3) planning time in choose_plan_name() since 8c49a484e8e |