diff options
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/execMain.c | 4 | ||||
-rw-r--r-- | src/backend/executor/functions.c | 4 | ||||
-rw-r--r-- | src/backend/executor/spi.c | 21 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index ee5c3a60ff3..28130fbc2b1 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -787,11 +787,11 @@ ExecCheckXactReadOnly(PlannedStmt *plannedstmt) if (isTempNamespace(get_rel_namespace(rte->relid))) continue; - PreventCommandIfReadOnly(CreateCommandTag((Node *) plannedstmt)); + PreventCommandIfReadOnly(CreateCommandName((Node *) plannedstmt)); } if (plannedstmt->commandType != CMD_SELECT || plannedstmt->hasModifyingCTE) - PreventCommandIfParallelMode(CreateCommandTag((Node *) plannedstmt)); + PreventCommandIfParallelMode(CreateCommandName((Node *) plannedstmt)); } diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 5cff6c43216..9b45a8a9a0e 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -530,7 +530,7 @@ init_execution_state(List *queryTree_list, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /* translator: %s is a SQL statement name */ errmsg("%s is not allowed in a SQL function", - CreateCommandTag(stmt->utilityStmt)))); + CreateCommandName(stmt->utilityStmt)))); } if (fcache->readonly_func && !CommandIsReadOnly(stmt)) @@ -538,7 +538,7 @@ init_execution_state(List *queryTree_list, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /* translator: %s is a SQL statement name */ errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag((Node *) stmt)))); + CreateCommandName((Node *) stmt)))); /* OK, build the execution_state for this query */ newes = (execution_state *) palloc(sizeof(execution_state)); diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index c46764bf428..b1081688211 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -1338,7 +1338,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, (errcode(ERRCODE_INVALID_CURSOR_DEFINITION), /* translator: %s is name of a SQL command, eg INSERT */ errmsg("cannot open %s query as cursor", - plansource->commandTag))); + GetCommandTagName(plansource->commandTag)))); } Assert(list_length(plan->plancache_list) == 1); @@ -1469,7 +1469,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, (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)))); + CreateCommandName((Node *) pstmt)))); } } @@ -2255,7 +2255,7 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /* translator: %s is a SQL statement name */ errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag((Node *) stmt)))); + CreateCommandName((Node *) stmt)))); /* * If not read-only mode, advance the command counter before each @@ -2291,8 +2291,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, } else { - char completionTag[COMPLETION_TAG_BUFSIZE]; ProcessUtilityContext context; + QueryCompletion qc; /* * If the SPI context is atomic, or we are asked to manage @@ -2306,13 +2306,14 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, else context = PROCESS_UTILITY_QUERY_NONATOMIC; + InitializeQueryCompletion(&qc); ProcessUtility(stmt, plansource->query_string, context, paramLI, _SPI_current->queryEnv, dest, - completionTag); + &qc); /* Update "processed" if stmt returned tuples */ if (_SPI_current->tuptable) @@ -2328,9 +2329,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, { CreateTableAsStmt *ctastmt = (CreateTableAsStmt *) stmt->utilityStmt; - if (strncmp(completionTag, "SELECT ", 7) == 0) - _SPI_current->processed = - pg_strtouint64(completionTag + 7, NULL, 10); + if (qc.commandTag == CMDTAG_SELECT) + _SPI_current->processed = qc.nprocessed; else { /* @@ -2351,9 +2351,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, } else if (IsA(stmt->utilityStmt, CopyStmt)) { - Assert(strncmp(completionTag, "COPY ", 5) == 0); - _SPI_current->processed = pg_strtouint64(completionTag + 5, - NULL, 10); + Assert(qc.commandTag == CMDTAG_COPY); + _SPI_current->processed = qc.nprocessed; } } |