PG-338: Fix query call count (utilities).
There was a missing increment/decrement to exec_nested_level in pgss_ProcessUtility hook, due to this, some utility statements could end up being processed more than once, as PostgreSQL may recurse into this hook for sub-statements or when processing a query string containing multiple semicolon-separated statements.pull/188/head
parent
cb5aab89b3
commit
79e0a86e4b
|
@ -980,6 +980,7 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
|||
WalUsage walusage_start = pgWalUsage;
|
||||
#endif
|
||||
INSTR_TIME_SET_CURRENT(start);
|
||||
exec_nested_level++;
|
||||
PG_TRY();
|
||||
{
|
||||
#if PG_VERSION_NUM >= 140000
|
||||
|
@ -1018,12 +1019,12 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
|||
dest,
|
||||
completionTag);
|
||||
#endif
|
||||
exec_nested_level--;
|
||||
}
|
||||
PG_CATCH();
|
||||
{
|
||||
nested_level--;
|
||||
PG_RE_THROW();
|
||||
|
||||
}
|
||||
|
||||
PG_END_TRY();
|
||||
|
|
Loading…
Reference in New Issue