aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-08-24 21:20:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-08-24 21:20:36 +0000
commit99ee43c57b611d846ab888ba88c03f052a0d4511 (patch)
treef3e4834eedb05c33ecb7426ca5bfecb868623e01 /src/backend/commands/explain.c
parent5c788e7cf5026be1cad634f12bb42111a411cd9e (diff)
downloadpostgresql-99ee43c57b611d846ab888ba88c03f052a0d4511.tar.gz
postgresql-99ee43c57b611d846ab888ba88c03f052a0d4511.zip
Make EXPLAIN show the function call expression of a FunctionScan plan node,
but only in VERBOSE mode. Per discussion.
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index c8fa693a60e..96088a2fbaa 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.207 2010/07/13 20:57:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.208 2010/08/24 21:20:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,6 +59,9 @@ static void ExplainNode(PlanState *planstate, List *ancestors,
ExplainState *es);
static void show_plan_tlist(PlanState *planstate, List *ancestors,
ExplainState *es);
+static void show_expression(Node *node, const char *qlabel,
+ PlanState *planstate, List *ancestors,
+ bool useprefix, ExplainState *es);
static void show_qual(List *qual, const char *qlabel,
PlanState *planstate, List *ancestors,
bool useprefix, ExplainState *es);
@@ -1017,13 +1020,19 @@ ExplainNode(PlanState *planstate, List *ancestors,
"Recheck Cond", planstate, ancestors, es);
/* FALL THRU */
case T_SeqScan:
- case T_FunctionScan:
case T_ValuesScan:
case T_CteScan:
case T_WorkTableScan:
case T_SubqueryScan:
show_scan_qual(plan->qual, "Filter", planstate, ancestors, es);
break;
+ case T_FunctionScan:
+ if (es->verbose)
+ show_expression(((FunctionScan *) plan)->funcexpr,
+ "Function Call", planstate, ancestors,
+ es->verbose, es);
+ show_scan_qual(plan->qual, "Filter", planstate, ancestors, es);
+ break;
case T_TidScan:
{
/*
@@ -1282,24 +1291,16 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es)
}
/*
- * Show a qualifier expression
+ * Show a generic expression
*/
static void
-show_qual(List *qual, const char *qlabel,
- PlanState *planstate, List *ancestors,
- bool useprefix, ExplainState *es)
+show_expression(Node *node, const char *qlabel,
+ PlanState *planstate, List *ancestors,
+ bool useprefix, ExplainState *es)
{
List *context;
- Node *node;
char *exprstr;
- /* No work if empty qual */
- if (qual == NIL)
- return;
-
- /* Convert AND list to explicit AND */
- node = (Node *) make_ands_explicit(qual);
-
/* Set up deparsing context */
context = deparse_context_for_planstate((Node *) planstate,
ancestors,
@@ -1313,6 +1314,27 @@ show_qual(List *qual, const char *qlabel,
}
/*
+ * Show a qualifier expression (which is a List with implicit AND semantics)
+ */
+static void
+show_qual(List *qual, const char *qlabel,
+ PlanState *planstate, List *ancestors,
+ bool useprefix, ExplainState *es)
+{
+ Node *node;
+
+ /* No work if empty qual */
+ if (qual == NIL)
+ return;
+
+ /* Convert AND list to explicit AND */
+ node = (Node *) make_ands_explicit(qual);
+
+ /* And show it */
+ show_expression(node, qlabel, planstate, ancestors, useprefix, es);
+}
+
+/*
* Show a qualifier expression for a scan plan node
*/
static void