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 <[email protected]>
Reviewed-by: Kirill Reshke <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/cacjufxhb8ypq095r_pydr77w9xknaxg5rzy-wp525mkq+hr...@mail.gmail.com

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(+)

Reply via email to