aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/functions.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 0a1bb9d52ee..039defa7b85 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -500,7 +500,16 @@ init_execution_state(List *queryTree_list,
fcache->readonly_func ? CURSOR_OPT_PARALLEL_OK : 0,
NULL);
- /* Precheck all commands for validity in a function */
+ /*
+ * Precheck all commands for validity in a function. This should
+ * generally match the restrictions spi.c applies.
+ */
+ if (IsA(stmt, CopyStmt) &&
+ ((CopyStmt *) stmt)->filename == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot COPY to/from client in a SQL function")));
+
if (IsA(stmt, TransactionStmt))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),