summaryrefslogtreecommitdiff
path: root/src/include/commands/trigger.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-10-26 02:26:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-10-26 02:26:45 +0000
commit9f2ee8f287098fb8067593b38da0650df458b20a (patch)
tree8998549ba80c6f5b397ad1e77dc6f03aefee00c2 /src/include/commands/trigger.h
parent76d8883c8e3647ac2f7ff3c48226a25b1fd7888b (diff)
downloadpostgresql-9f2ee8f287098fb8067593b38da0650df458b20a.tar.gz
Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases. We now identify the "current" row for every joined relation in UPDATE, DELETE, and SELECT FOR UPDATE/SHARE queries. If an EvalPlanQual recheck is necessary, we jam the appropriate row into each scan node in the rechecking plan, forcing it to emit only that one row. The former behavior could rescan the whole of each joined relation for each recheck, which was terrible for performance, and what's much worse could result in duplicated output tuples. Also, the original implementation of EvalPlanQual could not re-use the recheck execution tree --- it had to go through a full executor init and shutdown for every row to be tested. To avoid this overhead, I've associated a special runtime Param with each LockRows or ModifyTable plan node, and arranged to make every scan node below such a node depend on that Param. Thus, by signaling a change in that Param, the EPQ machinery can just rescan the already-built test plan. This patch also adds a prohibition on set-returning functions in the targetlist of SELECT FOR UPDATE/SHARE. This is needed to avoid the duplicate-output-tuple problem. It seems fairly reasonable since the other restrictions on SELECT FOR UPDATE are meant to ensure that there is a unique correspondence between source tuples and result tuples, which an output SRF destroys as much as anything else does.
Diffstat (limited to 'src/include/commands/trigger.h')
-rw-r--r--src/include/commands/trigger.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 94cb061959..2bf40b76af 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.76 2009/10/10 01:43:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.77 2009/10/26 02:26:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -139,7 +139,7 @@ extern void ExecBSDeleteTriggers(EState *estate,
extern void ExecASDeleteTriggers(EState *estate,
ResultRelInfo *relinfo);
extern bool ExecBRDeleteTriggers(EState *estate,
- PlanState *subplanstate,
+ EPQState *epqstate,
ResultRelInfo *relinfo,
ItemPointer tupleid);
extern void ExecARDeleteTriggers(EState *estate,
@@ -150,7 +150,7 @@ extern void ExecBSUpdateTriggers(EState *estate,
extern void ExecASUpdateTriggers(EState *estate,
ResultRelInfo *relinfo);
extern HeapTuple ExecBRUpdateTriggers(EState *estate,
- PlanState *subplanstate,
+ EPQState *epqstate,
ResultRelInfo *relinfo,
ItemPointer tupleid,
HeapTuple newtuple);