Re: Prevent COPY FREEZE on Foreign tables

From: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Sami Imseih <samimseih(at)gmail(dot)com>
Subject: Re: Prevent COPY FREEZE on Foreign tables
Date: 2025-02-04 01:31:06
Message-ID: 02445092-1d17-4489-a320-c48003e804c9@Spark
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Zhang Mingli
www.hashdata.xyz
On Feb 4, 2025 at 04:18 +0800, Sami Imseih <samimseih(at)gmail(dot)com>, wrote:
>
> This really does not make sense as this
> optimization cannot be applied to a remote table and it
> can give a user a false impression that it was.
+1,

```
+ /*
+ * Raise an error on foreign tables as it's not possible to apply
+ * the COPY FREEZE optimization to a remote relation.
+ */
+ if (cstate->rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot perform COPY FREEZE on a foreign table")));
+ }
+
```
Instead of throwing an error, how about we turn that into a warning?
This way, if someone is batch-importing data for multiple tables, it won’t interrupt their script that generates a COPY for each table.
Is it better to give them a heads-up without making them modify their commands right away?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michail Nikolaev 2025-02-04 01:38:00 Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Previous Message Tom Lane 2025-02-04 00:58:35 Re: Better title output for psql \dt \di etc. commands