diff options
Diffstat (limited to 'src/backend/executor/spi.c')
-rw-r--r-- | src/backend/executor/spi.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 4a6e82b6056..c46764bf428 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -1450,14 +1450,13 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, portal->queryEnv = _SPI_current->queryEnv; /* - * If told to be read-only, or in parallel mode, verify that this query is - * in fact read-only. This can't be done earlier because we need to look - * at the finished, planned queries. (In particular, we don't want to do - * it between GetCachedPlan and PortalDefineQuery, because throwing an - * error between those steps would result in leaking our plancache - * refcount.) + * If told to be read-only, we'd better check for read-only queries. This + * can't be done earlier because we need to look at the finished, planned + * queries. (In particular, we don't want to do it between GetCachedPlan + * and PortalDefineQuery, because throwing an error between those steps + * would result in leaking our plancache refcount.) */ - if (read_only || IsInParallelMode()) + if (read_only) { ListCell *lc; @@ -1466,16 +1465,11 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, PlannedStmt *pstmt = lfirst_node(PlannedStmt, lc); if (!CommandIsReadOnly(pstmt)) - { - if (read_only) - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - /* translator: %s is a SQL statement name */ - errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag((Node *) pstmt)))); - else - PreventCommandIfParallelMode(CreateCommandTag((Node *) pstmt)); - } + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + /* translator: %s is a SQL statement name */ + errmsg("%s is not allowed in a non-volatile function", + CreateCommandTag((Node *) pstmt)))); } } @@ -2263,9 +2257,6 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, errmsg("%s is not allowed in a non-volatile function", CreateCommandTag((Node *) stmt)))); - if (IsInParallelMode() && !CommandIsReadOnly(stmt)) - PreventCommandIfParallelMode(CreateCommandTag((Node *) stmt)); - /* * If not read-only mode, advance the command counter before each * command and update the snapshot. |