index 0a1bb9d52eeaa42f62f75ab3237ea7932cc5c84e..039defa7b85f681f5398838b7946fd9941ce9402 100644 (file)
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),