| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | COPY TO regression with psql -c |
| Date: | 2026-08-11 19:32:12 |
| Message-ID: | CAN4CZFPqa6c+u4uX5jJ8LANHTQ4dxM3m4_8G9WmX_A4-2wuv2A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hello
The recent COPY ... FROM STDIN improvement caused a regression in COPY
TO ... FROM STDIN when used together with psql -c: it only considers
the first statement, so the copy fails if multiple commands are
specified. A very simple example is:
psql -c "SELECT 1; COPY t FROM STDIN;"
now fails with unexpected COPY_IN.
This is probably an uncommon use case, but it has a few legitimate
uses in scripts, such as:
gzip -dc data.csv.gz | psql -c 'TRUNCATE t; COPY t FROM STDIN WITH (FORMAT CSV)'
to (re)load a table's data.
I attached a proposed patch with a tap test case that showcases the issue.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-psql-count-every-COPY-FROM-STDIN-when-scanning-a-que.patch | application/octet-stream | 4.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Korotkov | 2026-08-11 21:36:34 | Re: MERGE/SPLIT PARTITIONS issues/questions |
| Previous Message | Tom Lane | 2026-08-11 15:56:39 | Re: BUG #19615: COVAR_POP / COVAR_SAMP / REGR_SXY return 0.0 instead of NaN |