aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-10-10 01:43:50 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-10-10 01:43:50 +0000
commit8a5849b7ff24c637a1140c26fc171e45c9142005 (patch)
tree8f660c08709c999c3a4299436312390c53231b01 /src/backend/commands/explain.c
parentb865d2758255b767e30dc5f23c7c7d209e716f3b (diff)
downloadpostgresql-8a5849b7ff24c637a1140c26fc171e45c9142005.tar.gz
postgresql-8a5849b7ff24c637a1140c26fc171e45c9142005.zip
Split the processing of INSERT/UPDATE/DELETE operations out of execMain.c.
They are now handled by a new plan node type called ModifyTable, which is placed at the top of the plan tree. In itself this change doesn't do much, except perhaps make the handling of RETURNING lists and inherited UPDATEs a tad less klugy. But it is necessary preparation for the intended extension of allowing RETURNING queries inside WITH. Marko Tiikkaja
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index ef3d9beb062..048d12f97a2 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.190 2009/08/22 02:06:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.191 2009/10/10 01:43:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -581,6 +581,7 @@ ExplainNode(Plan *plan, PlanState *planstate,
const char *pname; /* node type name for text output */
const char *sname; /* node type name for non-text output */
const char *strategy = NULL;
+ const char *operation = NULL;
int save_indent = es->indent;
bool haschildren;
@@ -591,6 +592,24 @@ ExplainNode(Plan *plan, PlanState *planstate,
case T_Result:
pname = sname = "Result";
break;
+ case T_ModifyTable:
+ sname = "ModifyTable";
+ switch (((ModifyTable *) plan)->operation)
+ {
+ case CMD_INSERT:
+ pname = operation = "Insert";
+ break;
+ case CMD_UPDATE:
+ pname = operation = "Update";
+ break;
+ case CMD_DELETE:
+ pname = operation = "Delete";
+ break;
+ default:
+ pname = "???";
+ break;
+ }
+ break;
case T_Append:
pname = sname = "Append";
break;
@@ -736,6 +755,8 @@ ExplainNode(Plan *plan, PlanState *planstate,
ExplainPropertyText("Node Type", sname, es);
if (strategy)
ExplainPropertyText("Strategy", strategy, es);
+ if (operation)
+ ExplainPropertyText("Operation", operation, es);
if (relationship)
ExplainPropertyText("Parent Relationship", relationship, es);
if (plan_name)
@@ -1023,6 +1044,7 @@ ExplainNode(Plan *plan, PlanState *planstate,
haschildren = plan->initPlan ||
outerPlan(plan) ||
innerPlan(plan) ||
+ IsA(plan, ModifyTable) ||
IsA(plan, Append) ||
IsA(plan, BitmapAnd) ||
IsA(plan, BitmapOr) ||
@@ -1059,6 +1081,11 @@ ExplainNode(Plan *plan, PlanState *planstate,
/* special child plans */
switch (nodeTag(plan))
{
+ case T_ModifyTable:
+ ExplainMemberNodes(((ModifyTable *) plan)->plans,
+ ((ModifyTableState *) planstate)->mt_plans,
+ outer_plan, es);
+ break;
case T_Append:
ExplainMemberNodes(((Append *) plan)->appendplans,
((AppendState *) planstate)->appendplans,
@@ -1408,7 +1435,8 @@ ExplainScanTarget(Scan *plan, ExplainState *es)
}
/*
- * Explain the constituent plans of an Append, BitmapAnd, or BitmapOr node.
+ * Explain the constituent plans of a ModifyTable, Append, BitmapAnd,
+ * or BitmapOr node.
*
* Ordinarily we don't pass down outer_plan to our child nodes, but in these
* cases we must, since the node could be an "inner indexscan" in which case