pgsql: psql: count every COPY FROM STDIN when scanning a query string. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: psql: count every COPY FROM STDIN when scanning a query string.
Date
Msg-id E1wuuYL-00000000ZDc-3znG@gemulon.postgresql.org
Whole thread
List 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.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_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/52f1eaae6c1211d2c7da6f91f6262f7e8afc7a1f

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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: psql: count every COPY FROM STDIN when scanning a query string.
Next
From: Nathan Bossart
Date:
Subject: pgsql: Add missing PGDLLIMPORT marker.