diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-03-09 10:56:44 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-03-09 11:08:16 +0100 |
commit | df4c3cbd8f4f619785c735669150e3a1df9cf7ca (patch) | |
tree | 04cdd99397f5cfdb79a6d27f3736e6733fb4d48b /src/backend/tcop/postgres.c | |
parent | ddf590b8115212ea061f9428f20f4c36d8e25e62 (diff) | |
download | postgresql-df4c3cbd8f4f619785c735669150e3a1df9cf7ca.tar.gz postgresql-df4c3cbd8f4f619785c735669150e3a1df9cf7ca.zip |
Add parse_analyze_withcb()
This extracts code from pg_analyze_and_rewrite_withcb() into a
separate function that mirrors the existing
parse_analyze_fixedparams() and parse_analyze_varparams().
Reviewed-by: Nathan Bossart <bossartn@amazon.com>
Discussion: https://www.postgresql.org/message-id/flat/c67ce276-52b4-0239-dc0e-39875bf81840@enterprisedb.com
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index d7e39aed64b..ba2fcfeb4af 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -736,12 +736,8 @@ pg_analyze_and_rewrite_withcb(RawStmt *parsetree, void *parserSetupArg, QueryEnvironment *queryEnv) { - ParseState *pstate; Query *query; List *querytree_list; - JumbleState *jstate = NULL; - - Assert(query_string != NULL); /* required as of 8.4 */ TRACE_POSTGRESQL_QUERY_REWRITE_START(query_string); @@ -751,22 +747,8 @@ pg_analyze_and_rewrite_withcb(RawStmt *parsetree, if (log_parser_stats) ResetUsage(); - pstate = make_parsestate(NULL); - pstate->p_sourcetext = query_string; - pstate->p_queryEnv = queryEnv; - (*parserSetup) (pstate, parserSetupArg); - - query = transformTopLevelStmt(pstate, parsetree); - - if (IsQueryIdEnabled()) - jstate = JumbleQuery(query, query_string); - - if (post_parse_analyze_hook) - (*post_parse_analyze_hook) (pstate, query, jstate); - - free_parsestate(pstate); - - pgstat_report_query_id(query->queryId, false); + query = parse_analyze_withcb(parsetree, query_string, parserSetup, parserSetupArg, + queryEnv); if (log_parser_stats) ShowUsage("PARSE ANALYSIS STATISTICS"); |