pgsql: psql: count every COPY FROM STDIN when scanning a query string.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: psql: count every COPY FROM STDIN when scanning a query string.
Date: 2026-08-14 16:14:42
Message-ID: E1wuuYL-00000000ZDV-3mzv@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

psql: count every COPY FROM STDIN when scanning a query string.

When SendQuery() is not told how many COPY FROM STDIN commands the
query string contains (as for -c, \gexec, and \watch), it scans the
string to count them itself. But it called psql_scan() only once,
which stops at the first semicolon, so any COPY FROM STDIN past the
first sub-command was not counted, causing failure of cases that used
to work. Oversight in commit 3045a25ba.

Author: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAN4CZFPqa6c+u4uX5jJ8LANHTQ4dxM3m4_8G9WmX_A4-2wuv2A@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bcb776671d9b654ca753e4500faee8e95b61d6b5

Modified Files
--------------
src/bin/psql/common.c | 25 +++++++++++++++++++++++--
src/bin/psql/t/001_basic.pl | 30 ++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-08-14 16:14:43 pgsql: psql: count every COPY FROM STDIN when scanning a query string.
Previous Message Peter Eisentraut 2026-08-14 13:23:17 pgsql: Make generate_queries_for_path_pattern_recurse() interruptible