mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 05:46:52 +03:00
Add ExplainState argument to pg_plan_query() and planner().
This allows extensions to have access to any data they've stored in the ExplainState during planning. Unfortunately, it won't help with EXPLAIN EXECUTE is used, but since that case is less common, this still seems like an improvement. Since planner() has quite a few arguments now, also add some documentation of those arguments and the return value. Author: Robert Haas <rhaas@postgresql.org> Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrei Lepikhov <lepihov@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com
This commit is contained in:
@@ -338,7 +338,8 @@ static void pgss_post_parse_analyze(ParseState *pstate, Query *query,
|
||||
static PlannedStmt *pgss_planner(Query *parse,
|
||||
const char *query_string,
|
||||
int cursorOptions,
|
||||
ParamListInfo boundParams);
|
||||
ParamListInfo boundParams,
|
||||
ExplainState *es);
|
||||
static void pgss_ExecutorStart(QueryDesc *queryDesc, int eflags);
|
||||
static void pgss_ExecutorRun(QueryDesc *queryDesc,
|
||||
ScanDirection direction,
|
||||
@@ -894,7 +895,8 @@ static PlannedStmt *
|
||||
pgss_planner(Query *parse,
|
||||
const char *query_string,
|
||||
int cursorOptions,
|
||||
ParamListInfo boundParams)
|
||||
ParamListInfo boundParams,
|
||||
ExplainState *es)
|
||||
{
|
||||
PlannedStmt *result;
|
||||
|
||||
@@ -929,10 +931,10 @@ pgss_planner(Query *parse,
|
||||
{
|
||||
if (prev_planner_hook)
|
||||
result = prev_planner_hook(parse, query_string, cursorOptions,
|
||||
boundParams);
|
||||
boundParams, es);
|
||||
else
|
||||
result = standard_planner(parse, query_string, cursorOptions,
|
||||
boundParams);
|
||||
boundParams, es);
|
||||
}
|
||||
PG_FINALLY();
|
||||
{
|
||||
@@ -978,10 +980,10 @@ pgss_planner(Query *parse,
|
||||
{
|
||||
if (prev_planner_hook)
|
||||
result = prev_planner_hook(parse, query_string, cursorOptions,
|
||||
boundParams);
|
||||
boundParams, es);
|
||||
else
|
||||
result = standard_planner(parse, query_string, cursorOptions,
|
||||
boundParams);
|
||||
boundParams, es);
|
||||
}
|
||||
PG_FINALLY();
|
||||
{
|
||||
|
Reference in New Issue
Block a user