pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: psql: count every COPY FROM STDIN when scanning a query string.
Date: Fri, 14 Aug 2026 16:14:43 +0000
Message-ID: <E1wuuYM-00000000ZDh-07NV@gemulon.postgresql.org> (raw)

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.parragi@percona.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAN4CZFPqa6c+u4uX5jJ8LANHTQ4dxM3m4_8G9WmX_A4-2wuv2A@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/bin/psql/common.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1wuuYM-00000000ZDh-07NV@gemulon.postgresql.org>
Permalink:  ../E1wuuYM-00000000ZDh-07NV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wuuYM-00000000ZDh-07NV@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: psql: count every COPY FROM STDIN when scanning a query string.
  In-Reply-To: <E1wuuYM-00000000ZDh-07NV@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox