Re: Prevent COPY FREEZE on Foreign tables - Mailing list pgsql-hackers

From Zhang Mingli
Subject Re: Prevent COPY FREEZE on Foreign tables
Date
Msg-id 02445092-1d17-4489-a320-c48003e804c9@Spark
Whole thread Raw
List pgsql-hackers
Hi,


Zhang Mingli
www.hashdata.xyz
On Feb 4, 2025 at 04:18 +0800, Sami Imseih <samimseih@gmail.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?

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Better title output for psql \dt \di etc. commands
Next
From: wenhui qiu
Date:
Subject: Re: New GUC autovacuum_max_threshold ?