Documentation / Extension Hooks / Parsing and utility commands
post_parse_analyze_hook
post_parse_analyze_hook
Hook for plugins to get control at end of parse analysis
Reading PostgreSQL 18.
Description
Hook for plugins to get control at end of parse analysis
- Interface type
- post_parse_analyze_hook_type
- Header
- src/include/parser/analyze.h
- Subsystem
- Parsing and utility commands
- Initial value
- NULL (no hook installed)
C interface
typedef void (*post_parse_analyze_hook_type) (ParseState *pstate, Query *query, JumbleState *jstate);
extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook;Call sites
src/backend/commands/explain.c:194
src/backend/commands/explain.c:427
src/backend/commands/explain.c:453
src/backend/parser/analyze.c:128
src/backend/parser/analyze.c:170
src/backend/parser/analyze.c:207
Core call context: src/backend/commands/explain.c:188–202
/* Extract the query and, if enabled, jumble it */
query = castNode(Query, stmt->query);
if (IsQueryIdEnabled())
jstate = JumbleQuery(query);
if (post_parse_analyze_hook)
(*post_parse_analyze_hook) (pstate, query, jstate);
/*
* Parse analysis was done already, but we still have to run the rule
* rewriter. We do not do AcquireRewriteLocks: we assume the query either
* came straight from the parser, or suitable locks were acquired by
* plancache.c.
*/
rewritten = QueryRewrite(castNode(Query, stmt->query));Core call context: src/backend/commands/explain.c:421–435
}
ctas_query = castNode(Query, copyObject(ctas->query));
if (IsQueryIdEnabled())
jstate = JumbleQuery(ctas_query);
if (post_parse_analyze_hook)
(*post_parse_analyze_hook) (pstate, ctas_query, jstate);
rewritten = QueryRewrite(ctas_query);
Assert(list_length(rewritten) == 1);
ExplainOneQuery(linitial_node(Query, rewritten),
CURSOR_OPT_PARALLEL_OK, ctas->into, es,
pstate, params);
}
else if (IsA(utilityStmt, DeclareCursorStmt))
{Core call context: src/backend/commands/explain.c:447–461
JumbleState *jstate = NULL;
dcs_query = castNode(Query, copyObject(dcs->query));
if (IsQueryIdEnabled())
jstate = JumbleQuery(dcs_query);
if (post_parse_analyze_hook)
(*post_parse_analyze_hook) (pstate, dcs_query, jstate);
rewritten = QueryRewrite(dcs_query);
Assert(list_length(rewritten) == 1);
ExplainOneQuery(linitial_node(Query, rewritten),
dcs->options, NULL, es,
pstate, params);
}
else if (IsA(utilityStmt, ExecuteStmt))Documentation and source
Source build
- Version
- 18
- Build
- REL_18_STABLE
- Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd
Related entries
ProcessUtility_hookProcessUtility_hook
Back to Extension Hooks · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.