aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/execnodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-02-25 18:56:23 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-02-25 18:58:02 -0500
commit389af951552ff2209eae3e62fa147fef12329d4f (patch)
tree647af6827c57dc5bd902ec98db80269f950a57f0 /src/include/nodes/execnodes.h
parent0056066d06067d2d7fc84b31937933b5724347d0 (diff)
downloadpostgresql-389af951552ff2209eae3e62fa147fef12329d4f.tar.gz
postgresql-389af951552ff2209eae3e62fa147fef12329d4f.zip
Support data-modifying commands (INSERT/UPDATE/DELETE) in WITH.
This patch implements data-modifying WITH queries according to the semantics that the updates all happen with the same command counter value, and in an unspecified order. Therefore one WITH clause can't see the effects of another, nor can the outer query see the effects other than through the RETURNING values. And attempts to do conflicting updates will have unpredictable results. We'll need to document all that. This commit just fixes the code; documentation updates are waiting on author. Marko Tiikkaja and Hitoshi Harada
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r--src/include/nodes/execnodes.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 0a6b829de4f..d9aec4c26a3 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -346,7 +346,7 @@ typedef struct EState
/* If query can insert/delete tuples, the command ID to mark them with */
CommandId es_output_cid;
- /* Info about target table for insert/update/delete queries: */
+ /* Info about target table(s) for insert/update/delete queries: */
ResultRelInfo *es_result_relations; /* array of ResultRelInfos */
int es_num_result_relations; /* length of array */
ResultRelInfo *es_result_relation_info; /* currently active array elt */
@@ -378,6 +378,8 @@ typedef struct EState
List *es_subplanstates; /* List of PlanState for SubPlans */
+ List *es_auxmodifytables; /* List of secondary ModifyTableStates */
+
/*
* this ExprContext is for per-output-tuple operations, such as constraint
* checks and index-value computations. It will be reset for each output
@@ -1041,10 +1043,13 @@ typedef struct ResultState
typedef struct ModifyTableState
{
PlanState ps; /* its first field is NodeTag */
- CmdType operation;
+ CmdType operation; /* INSERT, UPDATE, or DELETE */
+ bool canSetTag; /* do we set the command tag/es_processed? */
+ bool mt_done; /* are we done? */
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) */
+ ResultRelInfo *resultRelInfo; /* per-subplan target relations */
List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */
EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */
bool fireBSTriggers; /* do we need to fire stmt triggers? */