diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 22dd55c378..b364492e0e 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -2272,6 +2272,27 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, _SPI_current->processed = pg_strtouint64(completionTag + 5, NULL, 10); } + else if (IsA(stmt->utilityStmt, ExecuteStmt)) + { + if (strncmp(completionTag, "INSERT ", 7) == 0) + { + char *p = completionTag + 7; + /* INSERT: skip oid and space */ + while (*p && *p != ' ') + p++; + if (*p != 0) + { + _SPI_current->processed = + pg_strtouint64(p, NULL, 10); + } + } + else if (strncmp(completionTag, "UPDATE ", 7) == 0 || + strncmp(completionTag, "DELETE ", 7) == 0) + { + _SPI_current->processed = + pg_strtouint64(completionTag + 7, NULL, 10); + } + } } /*