diff options
| author | Pavan Deolasee | 2014-10-31 07:41:38 +0000 |
|---|---|---|
| committer | Pavan Deolasee | 2015-04-15 05:46:38 +0000 |
| commit | 3e4346857d73841373b3424147e104a58802f8f3 (patch) | |
| tree | a4c1622ef4f7be72c408eeaf4bd039cffc29d209 /src | |
| parent | e8a3eea32e7b353754842100020dde8c244cbb16 (diff) | |
Allow pg_stat_statements to work with XL
XL uses a post-post-analyze hook for it's internal purposes. But this overrides
any existing hooks, including that of pg_stat_statements. Setup things so that
the previous hook gets called appropriately
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/parser/analyze.c | 9 | ||||
| -rw-r--r-- | src/backend/tcop/postgres.c | 2 | ||||
| -rw-r--r-- | src/include/parser/analyze.h | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 85feefdfce..c7befc1ba4 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -2545,6 +2545,11 @@ transformExecDirectStmt(ParseState *pstate, ExecDirectStmt *stmt) if (!is_local) result->utilityStmt = (Node *) step; + /* + * Reset the queryId since the caller would do that anyways. + */ + result->queryId = 0; + return result; } @@ -2900,6 +2905,8 @@ applyLockingClause(Query *qry, Index rtindex, } #ifdef XCP +post_parse_analyze_hook_type prev_ParseAnalyze_callback; + /* * Check if the query contains references to any pg_catalog tables that should * be remapped to storm_catalog. The list is obtained from the @@ -2908,6 +2915,8 @@ applyLockingClause(Query *qry, Index rtindex, void ParseAnalyze_callback(ParseState *pstate, Query *query) { + if (prev_ParseAnalyze_callback) + prev_ParseAnalyze_callback(pstate, query); ParseAnalyze_rtable_walk(query->rtable); } diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 43d37f927c..1143be2cc9 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -4285,6 +4285,8 @@ PostgresMain(int argc, char *argv[], const char *username) } /* Set up the post parse analyze hook */ + if (post_parse_analyze_hook) + prev_ParseAnalyze_callback = post_parse_analyze_hook; post_parse_analyze_hook = ParseAnalyze_callback; /* if we exit, try to release cluster lock properly */ diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h index dd72351533..014bbd54ef 100644 --- a/src/include/parser/analyze.h +++ b/src/include/parser/analyze.h @@ -47,5 +47,6 @@ extern void applyLockingClause(Query *qry, Index rtindex, #ifdef XCP extern void ParseAnalyze_callback(ParseState *pstate, Query *query); +extern post_parse_analyze_hook_type prev_ParseAnalyze_callback; #endif #endif /* ANALYZE_H */ |
