pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Disallow generated columns in COPY WHERE clause
Date: Thu, 06 Nov 2025 13:09:42 +0000
Message-ID: <E1vGzkE-005IUb-2O@gemulon.postgresql.org> (raw)

Disallow generated columns in COPY WHERE clause

Stored generated columns are not yet computed when the filtering
happens, so we need to prohibit them to avoid incorrect behavior.

Virtual generated columns currently error out ("unexpected virtual
generated column reference").  They could probably work if we expand
them in the right place, but for now let's keep them consistent with
the stored variant.  This doesn't change the behavior, it only gives a
nicer error message.

Co-authored-by: jian he <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxHb8YPQ095R_pYDr77W9XKNaXg5Rzy-WP525mkq+hRM3g@mail....

Branch
------
master

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

Modified Files
--------------
src/backend/commands/copy.c                     | 39 +++++++++++++++++++++++++
src/test/regress/expected/generated_stored.out  |  6 ++++
src/test/regress/expected/generated_virtual.out |  6 ++++
src/test/regress/sql/generated_stored.sql       |  4 +++
src/test/regress/sql/generated_virtual.sql      |  4 +++
5 files changed, 59 insertions(+)



view thread (7+ messages)  latest in thread

Message-ID: <E1vGzkE-005IUb-2O@gemulon.postgresql.org>
Permalink:  ../E1vGzkE-005IUb-2O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vGzkE-005IUb-2O@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: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Disallow generated columns in COPY WHERE clause
  In-Reply-To: <E1vGzkE-005IUb-2O@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