release_plan_on_error.patch
application/octet-stream
Filename: release_plan_on_error.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/executor/functions.c | 18 | 0 |
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 359aafea681..9c149c94c34 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -709,24 +709,42 @@ init_execution_state(SQLFunctionCachePtr fcache)
{
if (IsA(stmt->utilityStmt, CopyStmt) &&
((CopyStmt *) stmt->utilityStmt)->filename == NULL)
+ {
+ ReleaseCachedPlan(fcache->cplan, fcache->cowner);
+ fcache->cowner = NULL;
+ fcache->cplan = NULL;
+
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot COPY to/from client in an SQL function")));
+ }
if (IsA(stmt->utilityStmt, TransactionStmt))
+ {
+ ReleaseCachedPlan(fcache->cplan, fcache->cowner);
+ fcache->cowner = NULL;
+ fcache->cplan = NULL;
+
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
/* translator: %s is a SQL statement name */
errmsg("%s is not allowed in an SQL function",
CreateCommandName(stmt->utilityStmt))));
+ }
}
if (fcache->func->readonly_func && !CommandIsReadOnly(stmt))
+ {
+ ReleaseCachedPlan(fcache->cplan, fcache->cowner);
+ fcache->cowner = NULL;
+ fcache->cplan = NULL;
+
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
/* translator: %s is a SQL statement name */
errmsg("%s is not allowed in a non-volatile function",
CreateCommandName((Node *) stmt))));
+ }
/* OK, build the execution_state for this query */
newes = &fcache->esarray[foreach_current_index(lc)];