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

Commit99ee43c

Browse files
committed
Make EXPLAIN show the function call expression of a FunctionScan plan node,
but only in VERBOSE mode. Per discussion.
1 parent5c788e7 commit99ee43c

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

‎src/backend/commands/explain.c

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994-5, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.207 2010/07/1320:57:19 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.208 2010/08/24 21:20:36 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -59,6 +59,9 @@ static void ExplainNode(PlanState *planstate, List *ancestors,
5959
ExplainState*es);
6060
staticvoidshow_plan_tlist(PlanState*planstate,List*ancestors,
6161
ExplainState*es);
62+
staticvoidshow_expression(Node*node,constchar*qlabel,
63+
PlanState*planstate,List*ancestors,
64+
booluseprefix,ExplainState*es);
6265
staticvoidshow_qual(List*qual,constchar*qlabel,
6366
PlanState*planstate,List*ancestors,
6467
booluseprefix,ExplainState*es);
@@ -1017,13 +1020,19 @@ ExplainNode(PlanState *planstate, List *ancestors,
10171020
"Recheck Cond",planstate,ancestors,es);
10181021
/* FALL THRU */
10191022
caseT_SeqScan:
1020-
caseT_FunctionScan:
10211023
caseT_ValuesScan:
10221024
caseT_CteScan:
10231025
caseT_WorkTableScan:
10241026
caseT_SubqueryScan:
10251027
show_scan_qual(plan->qual,"Filter",planstate,ancestors,es);
10261028
break;
1029+
caseT_FunctionScan:
1030+
if (es->verbose)
1031+
show_expression(((FunctionScan*)plan)->funcexpr,
1032+
"Function Call",planstate,ancestors,
1033+
es->verbose,es);
1034+
show_scan_qual(plan->qual,"Filter",planstate,ancestors,es);
1035+
break;
10271036
caseT_TidScan:
10281037
{
10291038
/*
@@ -1282,24 +1291,16 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es)
12821291
}
12831292

12841293
/*
1285-
* Show aqualifier expression
1294+
* Show ageneric expression
12861295
*/
12871296
staticvoid
1288-
show_qual(List*qual,constchar*qlabel,
1289-
PlanState*planstate,List*ancestors,
1290-
booluseprefix,ExplainState*es)
1297+
show_expression(Node*node,constchar*qlabel,
1298+
PlanState*planstate,List*ancestors,
1299+
booluseprefix,ExplainState*es)
12911300
{
12921301
List*context;
1293-
Node*node;
12941302
char*exprstr;
12951303

1296-
/* No work if empty qual */
1297-
if (qual==NIL)
1298-
return;
1299-
1300-
/* Convert AND list to explicit AND */
1301-
node= (Node*)make_ands_explicit(qual);
1302-
13031304
/* Set up deparsing context */
13041305
context=deparse_context_for_planstate((Node*)planstate,
13051306
ancestors,
@@ -1312,6 +1313,27 @@ show_qual(List *qual, const char *qlabel,
13121313
ExplainPropertyText(qlabel,exprstr,es);
13131314
}
13141315

1316+
/*
1317+
* Show a qualifier expression (which is a List with implicit AND semantics)
1318+
*/
1319+
staticvoid
1320+
show_qual(List*qual,constchar*qlabel,
1321+
PlanState*planstate,List*ancestors,
1322+
booluseprefix,ExplainState*es)
1323+
{
1324+
Node*node;
1325+
1326+
/* No work if empty qual */
1327+
if (qual==NIL)
1328+
return;
1329+
1330+
/* Convert AND list to explicit AND */
1331+
node= (Node*)make_ands_explicit(qual);
1332+
1333+
/* And show it */
1334+
show_expression(node,qlabel,planstate,ancestors,useprefix,es);
1335+
}
1336+
13151337
/*
13161338
* Show a qualifier expression for a scan plan node
13171339
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp