aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/nodes')
-rw-r--r--src/include/nodes/execnodes.h24
-rw-r--r--src/include/nodes/nodes.h4
-rw-r--r--src/include/nodes/plannodes.h38
-rw-r--r--src/include/nodes/relation.h4
4 files changed, 39 insertions, 31 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index ea66e109c15..264ef741daf 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.208 2009/09/27 20:09:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.209 2009/10/10 01:43:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -339,7 +339,7 @@ typedef struct EState
ResultRelInfo *es_result_relations; /* array of ResultRelInfos */
int es_num_result_relations; /* length of array */
ResultRelInfo *es_result_relation_info; /* currently active array elt */
- JunkFilter *es_junkFilter; /* currently active junk filter */
+ JunkFilter *es_junkFilter; /* top-level junk filter, if any */
/* Stuff used for firing triggers: */
List *es_trig_target_relations; /* trigger-only ResultRelInfos */
@@ -976,12 +976,24 @@ typedef struct ResultState
} ResultState;
/* ----------------
+ * ModifyTableState information
+ * ----------------
+ */
+typedef struct ModifyTableState
+{
+ PlanState ps; /* its first field is NodeTag */
+ CmdType operation;
+ PlanState **mt_plans; /* subplans (one per target rel) */
+ int mt_nplans; /* number of plans in the array */
+ int mt_whichplan; /* which one is being executed (0..n-1) */
+ bool fireBSTriggers; /* do we need to fire stmt triggers? */
+} ModifyTableState;
+
+/* ----------------
* AppendState information
*
- * nplans how many plans are in the list
+ * nplans how many plans are in the array
* whichplan which plan is being executed (0 .. n-1)
- * firstplan first plan to execute (usually 0)
- * lastplan last plan to execute (usually n-1)
* ----------------
*/
typedef struct AppendState
@@ -990,8 +1002,6 @@ typedef struct AppendState
PlanState **appendplans; /* array of PlanStates for my inputs */
int as_nplans;
int as_whichplan;
- int as_firstplan;
- int as_lastplan;
} AppendState;
/* ----------------
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 2a4468799f9..53c406cc518 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.228 2009/10/08 02:39:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.229 2009/10/10 01:43:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,6 +43,7 @@ typedef enum NodeTag
*/
T_Plan = 100,
T_Result,
+ T_ModifyTable,
T_Append,
T_RecursiveUnion,
T_BitmapAnd,
@@ -81,6 +82,7 @@ typedef enum NodeTag
*/
T_PlanState = 200,
T_ResultState,
+ T_ModifyTableState,
T_AppendState,
T_RecursiveUnionState,
T_BitmapAndState,
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 44f14140f41..26b0fc33356 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.110 2009/06/11 14:49:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.111 2009/10/10 01:43:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,6 +38,8 @@ typedef struct PlannedStmt
CmdType commandType; /* select|insert|update|delete */
+ bool hasReturning; /* is it insert|update|delete RETURNING? */
+
bool canSetTag; /* do I set the command result tag? */
bool transientPlan; /* redo plan when TransactionXmin changes? */
@@ -57,18 +59,6 @@ typedef struct PlannedStmt
Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */
- /*
- * If the query has a returningList then the planner will store a list of
- * processed targetlists (one per result relation) here. We must have a
- * separate RETURNING targetlist for each result rel because column
- * numbers may vary within an inheritance tree. In the targetlists, Vars
- * referencing the result relation will have their original varno and
- * varattno, while Vars referencing other rels will be converted to have
- * varno OUTER and varattno referencing a resjunk entry in the top plan
- * node's targetlist.
- */
- List *returningLists; /* list of lists of TargetEntry, or NIL */
-
List *rowMarks; /* a list of RowMarkClause's */
List *relationOids; /* OIDs of relations the plan depends on */
@@ -165,21 +155,29 @@ typedef struct Result
} Result;
/* ----------------
+ * ModifyTable node -
+ * Apply rows produced by subplan(s) to result table(s),
+ * by inserting, updating, or deleting.
+ * ----------------
+ */
+typedef struct ModifyTable
+{
+ Plan plan;
+ CmdType operation; /* INSERT, UPDATE, or DELETE */
+ List *resultRelations; /* integer list of RT indexes */
+ List *plans; /* plan(s) producing source data */
+ List *returningLists; /* per-target-table RETURNING tlists */
+} ModifyTable;
+
+/* ----------------
* Append node -
* Generate the concatenation of the results of sub-plans.
- *
- * Append nodes are sometimes used to switch between several result relations
- * (when the target of an UPDATE or DELETE is an inheritance set). Such a
- * node will have isTarget true. The Append executor is then responsible
- * for updating the executor state to point at the correct target relation
- * whenever it switches subplans.
* ----------------
*/
typedef struct Append
{
Plan plan;
List *appendplans;
- bool isTarget;
} Append;
/* ----------------
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 9b59d63b2b3..5e504b0ab4b 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.175 2009/09/17 20:49:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.176 2009/10/10 01:43:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -140,8 +140,6 @@ typedef struct PlannerInfo
List *resultRelations; /* integer list of RT indexes, or NIL */
- List *returningLists; /* list of lists of TargetEntry, or NIL */
-
List *init_plans; /* init SubPlans for query */
List *cte_plan_ids; /* per-CTE-item list of subplan IDs */