pgsql: Fix wrong assertion and poor error messages in "COPY (query) TO"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix wrong assertion and poor error messages in "COPY (query) TO"
Date: 2024-10-21 19:08:42
Message-ID: E1t2xli-001nJJ-Nz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix wrong assertion and poor error messages in "COPY (query) TO".

If the query is rewritten into a NOTIFY command by a DO INSTEAD
rule, we'd get an assertion failure, or in non-assert builds
issue a rather confusing error message. Improve that.

Also fix a longstanding grammar mistake in a nearby error message.

Per bug #18664 from Alexander Lakhin. Back-patch to all supported
branches.

Tender Wang and Tom Lane

Discussion: https://postgr.es/m/18664-ffd0ebc2386598df@postgresql.org

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6c3b2d204f2b02dd80357742713d47050af30613

Modified Files
--------------
src/backend/commands/copyto.c | 8 ++++++--
src/test/regress/expected/copydml.out | 10 +++++++---
src/test/regress/sql/copydml.sql | 4 ++++
3 files changed, 17 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-10-22 04:07:08 pgsql: pg_stat_statements: Add tests for nested queries with level trac
Previous Message Heikki Linnakangas 2024-10-21 11:32:40 pgsql: Update outdated comment on WAL-logged locks with invalid XID