Subject: Document COPY FROM WHERE restrictions on generated and system columns

From: Fujii Masao <[email-masked]>
Date: Fri, 26 Jun 2026 01:46:41 +0900

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-masked]>
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

---

From: Ayush Tiwari <[email-masked]>
Date: Thu, 2 Jul 2026 18:46:41 +0530

Hi,

> does not need to be backpatched.

Thanks for the patch!

I think it makes sense to add the system columns and generated
columns limitation to the documentation, patch LGTM.

Regards,
Ayush

---

From: Fujii Masao <[email-masked]>
Date: Wed, 8 Jul 2026 12:48:31 +0900

> columns limitation to the documentation, patch LGTM.

Thanks for the review! I've pushed the patch.

Regards,

-- 
Fujii Masao