Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Bossart2025-02-06 21:23:40 +0000
committerNathan Bossart2025-02-06 21:23:40 +0000
commit401a6956fa69c9202cbc14c09ba8a9c430b90cac (patch)
treefafb71e2d66bf494abee2f15a85fb36161b91bb6 /src/backend/commands/copyfrom.c
parenta99a32e43ed72bd4fdb0950d2359fa4aa50fab76 (diff)
Disallow COPY FREEZE on foreign tables.
This didn't actually work: the COPY succeeds, but the FREEZE optimization isn't applied. There doesn't seem to be an easy way to support FREEZE on foreign tables, so let's follow the precedent established by commit 5c9a5513a3 by raising an error early. This is arguably a bug fix, but due to the lack of reports, the minimal discussion on the mailing list, and the potential to break existing scripts, I am not back-patching it for now. Author: Sami Imseih <samimseih@gmail.com> Reviewed-by: Zhang Mingli <zmlpostgres@gmail.com> Discussion: https://postgr.es/m/CAA5RZ0ujeNgKpE3OrLtR%3DeJGa5LkGMekFzQTwjgw%3DrzaLufQLQ%40mail.gmail.com
Diffstat (limited to 'src/backend/commands/copyfrom.c')
-rw-r--r--src/backend/commands/copyfrom.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c
index 0cbd05f5602..b70f4691b72 100644
--- a/src/backend/commands/copyfrom.c
+++ b/src/backend/commands/copyfrom.c
@@ -740,6 +740,12 @@ CopyFrom(CopyFromState cstate)
errmsg("cannot perform COPY FREEZE on a partitioned table")));
}
+ /* There's currently no support for COPY FREEZE on foreign tables. */
+ 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")));
+
/*
* Tolerate one registration for the benefit of FirstXactSnapshot.
* Scan-bearing queries generally create at least two registrations,