Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6bed7c

Browse files
committed
Fix print_node_explain. Avoid situation where an AQO node isn't initialized.
1 parentac7fc5c commitf6bed7c

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

‎path_utils.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ create_aqo_plan_node()
5656
returnnode;
5757
}
5858

59+
/*
60+
* Extract an AQO node from the plan private field.
61+
* If no one node was found, return pointer to the default value or allocate new
62+
* node (with default value) according to 'create' field.
63+
* Can't return NULL value at all.
64+
*/
5965
AQOPlanNode*
6066
get_aqo_plan_node(Plan*plan,boolcreate)
6167
{

‎postprocessing.c‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -857,26 +857,22 @@ ExtractFromQueryEnv(QueryDesc *queryDesc)
857857
void
858858
print_node_explain(ExplainState*es,PlanState*ps,Plan*plan)
859859
{
860-
intwrkrs=1;
861-
doubleerror=-1.;
862-
AQOPlanNode*aqo_node;
860+
intwrkrs=1;
861+
doubleerror=-1.;
862+
AQOPlanNode*aqo_node;
863863

864864
/* Extension, which took a hook early can be executed early too. */
865865
if (prev_ExplainOneNode_hook)
866866
prev_ExplainOneNode_hook(es,ps,plan);
867867

868-
if (IsQueryDisabled())
868+
if (IsQueryDisabled()|| !plan||es->format!=EXPLAIN_FORMAT_TEXT)
869869
return;
870870

871-
if (es->format!=EXPLAIN_FORMAT_TEXT)
872-
/* Only text format is supported. */
873-
return;
871+
aqo_node=get_aqo_plan_node(plan, false);
874872

875-
if (!aqo_show_details|| !plan|| !ps)
873+
if (!aqo_show_details|| !ps)
876874
gotoexplain_end;
877875

878-
aqo_node=get_aqo_plan_node(plan, false);
879-
880876
if (!ps->instrument)
881877
/* We can show only prediction, without error calculation */
882878
gotoexplain_print;
@@ -919,7 +915,7 @@ print_node_explain(ExplainState *es, PlanState *ps, Plan *plan)
919915
appendStringInfo(es->str,"AQO not used");
920916

921917
explain_end:
922-
/* XXX: Do we really have situationsthanplan is NULL? */
918+
/* XXX: Do we really have situationswhen theplan isaNULL pointer? */
923919
if (plan&&aqo_show_hash)
924920
appendStringInfo(es->str,", fss=%d",aqo_node->fss);
925921
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp