diff options
| author | Tom Lane | 2003-10-01 21:30:53 +0000 |
|---|---|---|
| committer | Tom Lane | 2003-10-01 21:30:53 +0000 |
| commit | 55d85f42a891a812a9bbd69ebe530651a2f31624 (patch) | |
| tree | cc2cb842242c7f683b73f6ac297a9939eb031976 /src/include | |
| parent | 6099bc03f34b02fd5cf99f4187c9c6c189cd3c66 (diff) | |
Repair RI trigger visibility problems (this time for sure ;-)) per recent
discussion on pgsql-hackers: in READ COMMITTED mode we just have to force
a QuerySnapshot update in the trigger, but in SERIALIZABLE mode we have
to run the scan under a current snapshot and then complain if any rows
would be updated/deleted that are not visible in the transaction snapshot.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/heapam.h | 6 | ||||
| -rw-r--r-- | src/include/executor/executor.h | 4 | ||||
| -rw-r--r-- | src/include/executor/spi.h | 6 | ||||
| -rw-r--r-- | src/include/nodes/execnodes.h | 4 | ||||
| -rw-r--r-- | src/include/utils/tqual.h | 5 |
5 files changed, 13 insertions, 12 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 05801af9e16..ed46894d3a5 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: heapam.h,v 1.84 2003/09/15 23:33:43 tgl Exp $ + * $Id: heapam.h,v 1.85 2003/10/01 21:30:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -155,9 +155,9 @@ extern void setLastTid(const ItemPointer tid); extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid); extern int heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid, - CommandId cid, bool wait); + CommandId cid, Snapshot crosscheck, bool wait); extern int heap_update(Relation relation, ItemPointer otid, HeapTuple tup, - ItemPointer ctid, CommandId cid, bool wait); + ItemPointer ctid, CommandId cid, Snapshot crosscheck, bool wait); extern int heap_mark4update(Relation relation, HeapTuple tup, Buffer *userbuf, CommandId cid); diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 034494b844f..ad30681f1cd 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: executor.h,v 1.101 2003/09/25 18:58:35 tgl Exp $ + * $Id: executor.h,v 1.102 2003/10/01 21:30:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -85,7 +85,7 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot); /* * prototypes from functions in execMain.c */ -extern void ExecutorStart(QueryDesc *queryDesc, bool useSnapshotNow, +extern void ExecutorStart(QueryDesc *queryDesc, bool useCurrentSnapshot, bool explainOnly); extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, long count); diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index 800616b56b6..bc86c665cba 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -2,7 +2,7 @@ * * spi.h * - * $Id: spi.h,v 1.38 2003/09/25 18:58:36 tgl Exp $ + * $Id: spi.h,v 1.39 2003/10/01 21:30:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -84,8 +84,8 @@ extern void SPI_pop(void); extern int SPI_exec(const char *src, int tcount); extern int SPI_execp(void *plan, Datum *values, const char *Nulls, int tcount); -extern int SPI_execp_now(void *plan, Datum *values, const char *Nulls, - int tcount); +extern int SPI_execp_current(void *plan, Datum *values, const char *Nulls, + bool useCurrentSnapshot, int tcount); extern void *SPI_prepare(const char *src, int nargs, Oid *argtypes); extern void *SPI_saveplan(void *plan); extern int SPI_freeplan(void *plan); diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index b40df717765..4112cd49de6 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execnodes.h,v 1.106 2003/09/25 18:58:36 tgl Exp $ + * $Id: execnodes.h,v 1.107 2003/10/01 21:30:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -286,7 +286,7 @@ typedef struct EState /* Basic state for all query types: */ ScanDirection es_direction; /* current scan direction */ Snapshot es_snapshot; /* time qual to use */ - CommandId es_snapshot_cid; /* CommandId component of time qual */ + Snapshot es_crosscheck_snapshot; /* crosscheck time qual for RI */ List *es_range_table; /* List of RangeTableEntrys */ /* Info about target table for insert/update/delete queries: */ diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h index 0c9f10f368c..b363f89840d 100644 --- a/src/include/utils/tqual.h +++ b/src/include/utils/tqual.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: tqual.h,v 1.47 2003/09/25 18:58:36 tgl Exp $ + * $Id: tqual.h,v 1.48 2003/10/01 21:30:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -100,7 +100,7 @@ extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple); extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple); extern bool HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot); -extern int HeapTupleSatisfiesUpdate(HeapTuple tuple, +extern int HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid); extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin); @@ -108,6 +108,7 @@ extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, extern Snapshot GetSnapshotData(Snapshot snapshot, bool serializable); extern void SetQuerySnapshot(void); extern Snapshot CopyQuerySnapshot(void); +extern Snapshot CopyCurrentSnapshot(void); extern void FreeXactSnapshot(void); #endif /* TQUAL_H */ |
