| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: COPY WHERE clause generated/system column reference |
| Date: | 2025-11-06 13:17:46 |
| Message-ID: | dcd6bab8-6c02-41ac-879f-ad54987ff506@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 05.11.25 19:19, Masahiko Sawada wrote:
>> Attached is my proposed patch. I kept it similar to the recently
>> committed fix in commit ba99c9491c4. Note that we also need to consider
>> whole-row references, as that patch did.
>
> Here are some minor comments for the proposed patch:
>
> + ereport(ERROR,
> + errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> + errmsg("generated columns are not
> supported in COPY FROM WHERE conditions"),
> + errdetail("Column \"%s\" is a generated column.",
> +
> get_attname(RelationGetRelid(rel), attno, false)));
>
> How about using ERRCODE_INVALID_COLUMN_REFERENCE instead? It's more
> consistent with other places where we check the column references.
>
> ---
> --- a/src/test/regress/sql/copy2.sql
> +++ b/src/test/regress/sql/copy2.sql
> @@ -161,7 +161,6 @@ COPY x from stdin WHERE a IN (generate_series(1,5));
>
> COPY x from stdin WHERE a = row_number() over(b);
>
> -
> -- check results of copy in
> SELECT * FROM x;
>
> Unnecessary line removal.
>
> The rest looks good to me.
Thanks. I have committed it with these corrections.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Munro | 2025-11-06 13:43:45 | Re: [PATCH] O_CLOEXEC not honored on Windows - handle inheritance chain |
| Previous Message | Euler Taveira | 2025-11-06 13:09:06 | Re: log_min_messages per backend type |