Change the return value of HeapTupleSatisfiesUpdate() to be an enum,
rather than an integer, and fix the associated fallout. From Alvaro Herrera.
This commit is contained in:
parent
9e0dd84596
commit
fe7015f5e8
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.183 2005/02/20 21:46:47 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.184 2005/03/20 23:40:23 neilc Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* INTERFACE ROUTINES
|
* INTERFACE ROUTINES
|
||||||
|
@ -1265,7 +1265,7 @@ simple_heap_insert(Relation relation, HeapTuple tup)
|
||||||
* *ctid is set to the ctid link of the target tuple (possibly a later
|
* *ctid is set to the ctid link of the target tuple (possibly a later
|
||||||
* version of the row).
|
* version of the row).
|
||||||
*/
|
*/
|
||||||
int
|
HTSU_Result
|
||||||
heap_delete(Relation relation, ItemPointer tid,
|
heap_delete(Relation relation, ItemPointer tid,
|
||||||
ItemPointer ctid, CommandId cid,
|
ItemPointer ctid, CommandId cid,
|
||||||
Snapshot crosscheck, bool wait)
|
Snapshot crosscheck, bool wait)
|
||||||
|
@ -1275,7 +1275,7 @@ heap_delete(Relation relation, ItemPointer tid,
|
||||||
HeapTupleData tp;
|
HeapTupleData tp;
|
||||||
PageHeader dp;
|
PageHeader dp;
|
||||||
Buffer buffer;
|
Buffer buffer;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
Assert(ItemPointerIsValid(tid));
|
Assert(ItemPointerIsValid(tid));
|
||||||
|
|
||||||
|
@ -1430,7 +1430,7 @@ void
|
||||||
simple_heap_delete(Relation relation, ItemPointer tid)
|
simple_heap_delete(Relation relation, ItemPointer tid)
|
||||||
{
|
{
|
||||||
ItemPointerData ctid;
|
ItemPointerData ctid;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
result = heap_delete(relation, tid,
|
result = heap_delete(relation, tid,
|
||||||
&ctid,
|
&ctid,
|
||||||
|
@ -1480,7 +1480,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
|
||||||
* On success, newtup->t_self is set to the TID where the new tuple
|
* On success, newtup->t_self is set to the TID where the new tuple
|
||||||
* was inserted.
|
* was inserted.
|
||||||
*/
|
*/
|
||||||
int
|
HTSU_Result
|
||||||
heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
|
heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
|
||||||
ItemPointer ctid, CommandId cid,
|
ItemPointer ctid, CommandId cid,
|
||||||
Snapshot crosscheck, bool wait)
|
Snapshot crosscheck, bool wait)
|
||||||
|
@ -1495,7 +1495,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
|
||||||
already_marked;
|
already_marked;
|
||||||
Size newtupsize,
|
Size newtupsize,
|
||||||
pagefree;
|
pagefree;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
Assert(ItemPointerIsValid(otid));
|
Assert(ItemPointerIsValid(otid));
|
||||||
|
|
||||||
|
@ -1792,7 +1792,7 @@ void
|
||||||
simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
|
simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
|
||||||
{
|
{
|
||||||
ItemPointerData ctid;
|
ItemPointerData ctid;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
result = heap_update(relation, otid, tup,
|
result = heap_update(relation, otid, tup,
|
||||||
&ctid,
|
&ctid,
|
||||||
|
@ -1822,7 +1822,7 @@ simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
|
||||||
/*
|
/*
|
||||||
* heap_mark4update - mark a tuple for update
|
* heap_mark4update - mark a tuple for update
|
||||||
*/
|
*/
|
||||||
int
|
HTSU_Result
|
||||||
heap_mark4update(Relation relation, HeapTuple tuple, Buffer *buffer,
|
heap_mark4update(Relation relation, HeapTuple tuple, Buffer *buffer,
|
||||||
CommandId cid)
|
CommandId cid)
|
||||||
{
|
{
|
||||||
|
@ -1830,7 +1830,7 @@ heap_mark4update(Relation relation, HeapTuple tuple, Buffer *buffer,
|
||||||
ItemPointer tid = &(tuple->t_self);
|
ItemPointer tid = &(tuple->t_self);
|
||||||
ItemId lp;
|
ItemId lp;
|
||||||
PageHeader dp;
|
PageHeader dp;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
*buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
|
*buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
|
||||||
LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE);
|
LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.119 2005/01/27 23:23:54 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.120 2005/03/20 23:40:24 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -521,7 +521,7 @@ AtCommit_Notify(void)
|
||||||
else if (listener->notification == 0)
|
else if (listener->notification == 0)
|
||||||
{
|
{
|
||||||
ItemPointerData ctid;
|
ItemPointerData ctid;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
rTuple = heap_modifytuple(lTuple, tdesc,
|
rTuple = heap_modifytuple(lTuple, tdesc,
|
||||||
value, nulls, repl);
|
value, nulls, repl);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.177 2004/12/31 21:59:41 pgsql Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.178 2005/03/20 23:40:24 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -1566,7 +1566,7 @@ GetTupleForTrigger(EState *estate, ResultRelInfo *relinfo,
|
||||||
|
|
||||||
if (newSlot != NULL)
|
if (newSlot != NULL)
|
||||||
{
|
{
|
||||||
int test;
|
HTSU_Result test;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mark tuple for update
|
* mark tuple for update
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.242 2005/03/16 21:38:06 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.243 2005/03/20 23:40:25 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -1116,7 +1116,7 @@ lnext: ;
|
||||||
Buffer buffer;
|
Buffer buffer;
|
||||||
HeapTupleData tuple;
|
HeapTupleData tuple;
|
||||||
TupleTableSlot *newSlot;
|
TupleTableSlot *newSlot;
|
||||||
int test;
|
HTSU_Result test;
|
||||||
|
|
||||||
if (!ExecGetJunkAttribute(junkfilter,
|
if (!ExecGetJunkAttribute(junkfilter,
|
||||||
slot,
|
slot,
|
||||||
|
@ -1396,7 +1396,7 @@ ExecDelete(TupleTableSlot *slot,
|
||||||
ResultRelInfo *resultRelInfo;
|
ResultRelInfo *resultRelInfo;
|
||||||
Relation resultRelationDesc;
|
Relation resultRelationDesc;
|
||||||
ItemPointerData ctid;
|
ItemPointerData ctid;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get information on the (current) result relation
|
* get information on the (current) result relation
|
||||||
|
@ -1500,7 +1500,7 @@ ExecUpdate(TupleTableSlot *slot,
|
||||||
ResultRelInfo *resultRelInfo;
|
ResultRelInfo *resultRelInfo;
|
||||||
Relation resultRelationDesc;
|
Relation resultRelationDesc;
|
||||||
ItemPointerData ctid;
|
ItemPointerData ctid;
|
||||||
int result;
|
HTSU_Result result;
|
||||||
int numIndices;
|
int numIndices;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.85 2005/02/20 15:01:42 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.86 2005/03/20 23:40:27 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -455,7 +455,7 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple, Buffer buffer)
|
||||||
* tuples of my own xact are tested against the passed CommandId not
|
* tuples of my own xact are tested against the passed CommandId not
|
||||||
* CurrentCommandId.
|
* CurrentCommandId.
|
||||||
*/
|
*/
|
||||||
int
|
HTSU_Result
|
||||||
HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
|
HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
|
||||||
Buffer buffer)
|
Buffer buffer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.96 2005/03/16 21:38:09 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.97 2005/03/20 23:40:29 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -153,11 +153,11 @@ extern ItemPointer heap_get_latest_tid(Relation relation, Snapshot snapshot,
|
||||||
extern void setLastTid(const ItemPointer tid);
|
extern void setLastTid(const ItemPointer tid);
|
||||||
|
|
||||||
extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid);
|
extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid);
|
||||||
extern int heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid,
|
extern HTSU_Result heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid,
|
||||||
CommandId cid, Snapshot crosscheck, bool wait);
|
CommandId cid, Snapshot crosscheck, bool wait);
|
||||||
extern int heap_update(Relation relation, ItemPointer otid, HeapTuple tup,
|
extern HTSU_Result heap_update(Relation relation, ItemPointer otid, HeapTuple tup,
|
||||||
ItemPointer ctid, CommandId cid, Snapshot crosscheck, bool wait);
|
ItemPointer ctid, CommandId cid, Snapshot crosscheck, bool wait);
|
||||||
extern int heap_mark4update(Relation relation, HeapTuple tup,
|
extern HTSU_Result heap_mark4update(Relation relation, HeapTuple tup,
|
||||||
Buffer *userbuf, CommandId cid);
|
Buffer *userbuf, CommandId cid);
|
||||||
|
|
||||||
extern Oid simple_heap_insert(Relation relation, HeapTuple tup);
|
extern Oid simple_heap_insert(Relation relation, HeapTuple tup);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/utils/tqual.h,v 1.55 2004/12/31 22:03:46 pgsql Exp $
|
* $PostgreSQL: pgsql/src/include/utils/tqual.h,v 1.56 2005/03/20 23:40:34 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -97,11 +97,14 @@ extern TransactionId RecentGlobalXmin;
|
||||||
)
|
)
|
||||||
|
|
||||||
/* Result codes for HeapTupleSatisfiesUpdate */
|
/* Result codes for HeapTupleSatisfiesUpdate */
|
||||||
#define HeapTupleMayBeUpdated 0
|
typedef enum
|
||||||
#define HeapTupleInvisible 1
|
{
|
||||||
#define HeapTupleSelfUpdated 2
|
HeapTupleMayBeUpdated,
|
||||||
#define HeapTupleUpdated 3
|
HeapTupleInvisible,
|
||||||
#define HeapTupleBeingUpdated 4
|
HeapTupleSelfUpdated,
|
||||||
|
HeapTupleUpdated,
|
||||||
|
HeapTupleBeingUpdated
|
||||||
|
} HTSU_Result;
|
||||||
|
|
||||||
/* Result codes for HeapTupleSatisfiesVacuum */
|
/* Result codes for HeapTupleSatisfiesVacuum */
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -119,7 +122,7 @@ extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Buffer buffer);
|
||||||
extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple, Buffer buffer);
|
extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple, Buffer buffer);
|
||||||
extern bool HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple,
|
extern bool HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple,
|
||||||
Snapshot snapshot, Buffer buffer);
|
Snapshot snapshot, Buffer buffer);
|
||||||
extern int HeapTupleSatisfiesUpdate(HeapTupleHeader tuple,
|
extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTupleHeader tuple,
|
||||||
CommandId curcid, Buffer buffer);
|
CommandId curcid, Buffer buffer);
|
||||||
extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple,
|
extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple,
|
||||||
TransactionId OldestXmin, Buffer buffer);
|
TransactionId OldestXmin, Buffer buffer);
|
||||||
|
|
Loading…
Reference in New Issue