Skip to content

Commit c8b13a4

Browse files
committed
allow to run plpgsql_check regress test while pg_stat_statements is loaded
1 parent b4b0ba5 commit c8b13a4

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/profiler.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,11 +1804,22 @@ profiler_get_queryid(PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt,
18041804
static void
18051805
profiler_fake_queryid_hook(ParseState *pstate, Query *query, JumbleState *jstate)
18061806
{
1807-
(void) jstate;
1808-
(void) pstate;
1809-
1810-
Assert(query->queryId == NOQUERYID);
1807+
if (prev_post_parse_analyze_hook)
1808+
prev_post_parse_analyze_hook(pstate, query, jstate);
18111809

1810+
/*
1811+
* force fake queryid
1812+
*
1813+
* profiler_fake_queryid_hook is active only for one plpgsql_check
1814+
* regress test. For this case, we can force fake queryid, althought
1815+
* is possible, so real queryid (computed by pg_stat_statements) is
1816+
* already computed.
1817+
*
1818+
* Because this fake queryid hook is designed only for one test,
1819+
* I don't check this possibility, and I don't raise any warning (because
1820+
* it breaks stability of plpgsql_check regress tests - in dependency
1821+
* on active (or non active) pg_stat_statements).
1822+
*/
18121823
query->queryId = query->commandType;
18131824
}
18141825

0 commit comments

Comments
 (0)