summaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 09c593db37a..125a9d2063e 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.136.2.2 2003/05/19 17:23:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.136.2.3 2005/08/26 20:07:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1351,14 +1351,18 @@ GetTupleForTrigger(EState *estate, ResultRelInfo *relinfo,
if (newSlot != NULL)
{
int test;
+ ItemPointerData update_ctid;
+ TransactionId update_xmax;
+
+ *newSlot = NULL;
/*
* mark tuple for update
*/
- *newSlot = NULL;
- tuple.t_self = *tid;
ltrmark:;
- test = heap_mark4update(relation, &tuple, &buffer, cid);
+ tuple.t_self = *tid;
+ test = heap_mark4update(relation, &tuple, &buffer,
+ &update_ctid, &update_xmax, cid);
switch (test)
{
case HeapTupleSelfUpdated:
@@ -1373,15 +1377,18 @@ ltrmark:;
ReleaseBuffer(buffer);
if (XactIsoLevel == XACT_SERIALIZABLE)
elog(ERROR, "Can't serialize access due to concurrent update");
- else if (!(ItemPointerEquals(&(tuple.t_self), tid)))
+ else if (!ItemPointerEquals(&update_ctid, &tuple.t_self))
{
- TupleTableSlot *epqslot = EvalPlanQual(estate,
- relinfo->ri_RangeTableIndex,
- &(tuple.t_self));
-
- if (!(TupIsNull(epqslot)))
+ /* it was updated, so look at the updated version */
+ TupleTableSlot *epqslot;
+
+ epqslot = EvalPlanQual(estate,
+ relinfo->ri_RangeTableIndex,
+ &update_ctid,
+ update_xmax);
+ if (!TupIsNull(epqslot))
{
- *tid = tuple.t_self;
+ *tid = update_ctid;
*newSlot = epqslot;
goto ltrmark;
}
@@ -1418,6 +1425,7 @@ ltrmark:;
tuple.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tuple.t_len = ItemIdGetLength(lp);
tuple.t_self = *tid;
+ tuple.t_tableOid = RelationGetRelid(relation);
}
result = heap_copytuple(&tuple);