public inbox for [email protected]  
help / color / mirror / Atom feed
From: Fujii Masao <[email protected]>
To: [email protected]
Subject: Document COPY FROM WHERE restrictions on generated and system columns
Date: Fri, 26 Jun 2026 01:46:41 +0900
Message-ID: <CAHGQGwEgxErc54yVOAVWCsr1O=8pgw4oKRPuEQ9mfhkoYGR_XA@mail.gmail.com> (raw)

Hi,

I found that generated columns and system columns cannot be used in
COPY FROM WHERE expressions, but the COPY docs still mentions
only the restriction on subqueries.

So I've created the attached patch which updates the docs to also list
generated columns and system columns as unsupported in COPY FROM WHERE
expressions.

Since generated columns have been rejected in COPY FROM WHERE since
v13, that docs change should be backpatched to all supported branches.
But the system-column restriction was introduced in v19, so that part
does not need to be backpatched.

Thoughts?

Regards,

-- 
Fujii Masao

From 168af14a081eec04c03e509df21715cafa81582d Mon Sep 17 00:00:00 2001
From: Fujii Masao <[email protected]>
Date: Fri, 26 Jun 2026 00:56:51 +0900
Subject: [PATCH v1] doc: Clarify COPY FROM WHERE expression restrictions

Commit aa606b9316a disallowed generated columns in COPY FROM WHERE
expressions, and commit 21c69dc73f9 disallowed system columns.
However, the COPY reference page still mentions only the restriction
on subqueries.

Update the documentation to also list generated columns and system
columns as unsupported in COPY FROM WHERE expressions.

Backpatch the generated-column documentation change to all supported
branches. The system-column restriction was introduced in v19, so that
part does not need to be backpatched.
---
 doc/src/sgml/ref/copy.sgml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 8433344e5b6..5413bb0e12d 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -480,10 +480,11 @@ WHERE <replaceable class="parameter">condition</replaceable>
    </para>
 
    <para>
-    Currently, subqueries are not allowed in <literal>WHERE</literal>
-    expressions, and the evaluation does not see any changes made by the
-    <command>COPY</command> itself (this matters when the expression
-    contains calls to <literal>VOLATILE</literal> functions).
+    Currently, subqueries and generated columns are not allowed in
+    <literal>WHERE</literal> expressions, and the evaluation does not see
+    any changes made by the <command>COPY</command> itself (this matters
+    when the expression contains calls to <literal>VOLATILE</literal>
+    functions).
    </para>
 
     </listitem>
-- 
2.53.0



Attachments:

  [text/plain] v1-v14-18-0001-doc-Clarify-COPY-FROM-WHERE-expression-restrictio.txt (1.7K, ../CAHGQGwEgxErc54yVOAVWCsr1O=8pgw4oKRPuEQ9mfhkoYGR_XA@mail.gmail.com/2-v1-v14-18-0001-doc-Clarify-COPY-FROM-WHERE-expression-restrictio.txt)
  download | inline diff:
From 168af14a081eec04c03e509df21715cafa81582d Mon Sep 17 00:00:00 2001
From: Fujii Masao <[email protected]>
Date: Fri, 26 Jun 2026 00:56:51 +0900
Subject: [PATCH v1] doc: Clarify COPY FROM WHERE expression restrictions

Commit aa606b9316a disallowed generated columns in COPY FROM WHERE
expressions, and commit 21c69dc73f9 disallowed system columns.
However, the COPY reference page still mentions only the restriction
on subqueries.

Update the documentation to also list generated columns and system
columns as unsupported in COPY FROM WHERE expressions.

Backpatch the generated-column documentation change to all supported
branches. The system-column restriction was introduced in v19, so that
part does not need to be backpatched.
---
 doc/src/sgml/ref/copy.sgml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 8433344e5b6..5413bb0e12d 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -480,10 +480,11 @@ WHERE <replaceable class="parameter">condition</replaceable>
    </para>
 
    <para>
-    Currently, subqueries are not allowed in <literal>WHERE</literal>
-    expressions, and the evaluation does not see any changes made by the
-    <command>COPY</command> itself (this matters when the expression
-    contains calls to <literal>VOLATILE</literal> functions).
+    Currently, subqueries and generated columns are not allowed in
+    <literal>WHERE</literal> expressions, and the evaluation does not see
+    any changes made by the <command>COPY</command> itself (this matters
+    when the expression contains calls to <literal>VOLATILE</literal>
+    functions).
    </para>
 
     </listitem>
-- 
2.53.0



  [application/octet-stream] v1-0001-doc-Clarify-COPY-FROM-WHERE-expression-restrictio.patch (1.7K, ../CAHGQGwEgxErc54yVOAVWCsr1O=8pgw4oKRPuEQ9mfhkoYGR_XA@mail.gmail.com/3-v1-0001-doc-Clarify-COPY-FROM-WHERE-expression-restrictio.patch)
  download | inline diff:
From b8638cf68a4ee4309dd832404e9845daa02f8b8a Mon Sep 17 00:00:00 2001
From: Fujii Masao <[email protected]>
Date: Fri, 26 Jun 2026 00:42:23 +0900
Subject: [PATCH v1] doc: Clarify COPY FROM WHERE expression restrictions

Commit aa606b9316a disallowed generated columns in COPY FROM WHERE
expressions, and commit 21c69dc73f9 disallowed system columns.
However, the COPY reference page still mentions only the restriction
on subqueries.

Update the documentation to also list generated columns and system
columns as unsupported in COPY FROM WHERE expressions.

Backpatch the generated-column documentation change to all supported
branches. The system-column restriction was introduced in v19, so that
part does not need to be backpatched.
---
 doc/src/sgml/ref/copy.sgml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 4706c9a4410..b23433b2c41 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -545,10 +545,11 @@ WHERE <replaceable class="parameter">condition</replaceable>
    </para>
 
    <para>
-    Currently, subqueries are not allowed in <literal>WHERE</literal>
-    expressions, and the evaluation does not see any changes made by the
-    <command>COPY</command> itself (this matters when the expression
-    contains calls to <literal>VOLATILE</literal> functions).
+    Currently, subqueries, system columns, and generated columns are not
+    allowed in <literal>WHERE</literal> expressions, and the evaluation
+    does not see any changes made by the <command>COPY</command> itself
+    (this matters when the expression contains calls to
+    <literal>VOLATILE</literal> functions).
    </para>
 
     </listitem>
-- 
2.53.0



view thread (3+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Document COPY FROM WHERE restrictions on generated and system columns
  In-Reply-To: <CAHGQGwEgxErc54yVOAVWCsr1O=8pgw4oKRPuEQ9mfhkoYGR_XA@mail.gmail.com>

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

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