From a40fa613b516b97c37d87ac1b21fb7aa8a2f2c1b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 27 Mar 2012 15:14:13 -0400 Subject: Add some infrastructure for contrib/pg_stat_statements. Add a queryId field to Query and PlannedStmt. This is not used by the core backend, except for being copied around at appropriate times. It's meant to allow plug-ins to track a particular query forward from parse analysis to execution. The queryId is intentionally not dumped into stored rules (and hence this commit doesn't bump catversion). You could argue that choice either way, but it seems better that stored rule strings not have any dependency on plug-ins that might or might not be present. Also, add a post_parse_analyze_hook that gets invoked at the end of parse analysis (but only for top-level analysis of complete queries, not cases such as analyzing a domain's default-value expression). This is mainly meant to be used to compute and assign a queryId, but it could have other applications. Peter Geoghegan --- src/backend/tcop/postgres.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 14ca7681392..02be36362ce 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -626,6 +626,9 @@ pg_analyze_and_rewrite_params(Node *parsetree, query = transformTopLevelStmt(pstate, parsetree); + if (post_parse_analyze_hook) + (*post_parse_analyze_hook) (pstate, query); + free_parsestate(pstate); if (log_parser_stats) -- cgit v1.2.3