Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe7015f

Browse files
author
Neil Conway
committed
Change the return value of HeapTupleSatisfiesUpdate() to be an enum,
rather than an integer, and fix the associated fallout. From AlvaroHerrera.
1 parent9e0dd84 commitfe7015f

File tree

7 files changed

+33
-30
lines changed

7 files changed

+33
-30
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.183 2005/02/2021:46:47 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.184 2005/03/2023:40:23 neilc Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1265,7 +1265,7 @@ simple_heap_insert(Relation relation, HeapTuple tup)
12651265
* *ctid is set to the ctid link of the target tuple (possibly a later
12661266
* version of the row).
12671267
*/
1268-
int
1268+
HTSU_Result
12691269
heap_delete(Relationrelation,ItemPointertid,
12701270
ItemPointerctid,CommandIdcid,
12711271
Snapshotcrosscheck,boolwait)
@@ -1275,7 +1275,7 @@ heap_delete(Relation relation, ItemPointer tid,
12751275
HeapTupleDatatp;
12761276
PageHeaderdp;
12771277
Bufferbuffer;
1278-
intresult;
1278+
HTSU_Resultresult;
12791279

12801280
Assert(ItemPointerIsValid(tid));
12811281

@@ -1430,7 +1430,7 @@ void
14301430
simple_heap_delete(Relationrelation,ItemPointertid)
14311431
{
14321432
ItemPointerDatactid;
1433-
intresult;
1433+
HTSU_Resultresult;
14341434

14351435
result=heap_delete(relation,tid,
14361436
&ctid,
@@ -1480,7 +1480,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
14801480
* On success, newtup->t_self is set to the TID where the new tuple
14811481
* was inserted.
14821482
*/
1483-
int
1483+
HTSU_Result
14841484
heap_update(Relationrelation,ItemPointerotid,HeapTuplenewtup,
14851485
ItemPointerctid,CommandIdcid,
14861486
Snapshotcrosscheck,boolwait)
@@ -1495,7 +1495,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
14951495
already_marked;
14961496
Sizenewtupsize,
14971497
pagefree;
1498-
intresult;
1498+
HTSU_Resultresult;
14991499

15001500
Assert(ItemPointerIsValid(otid));
15011501

@@ -1792,7 +1792,7 @@ void
17921792
simple_heap_update(Relationrelation,ItemPointerotid,HeapTupletup)
17931793
{
17941794
ItemPointerDatactid;
1795-
intresult;
1795+
HTSU_Resultresult;
17961796

17971797
result=heap_update(relation,otid,tup,
17981798
&ctid,
@@ -1822,15 +1822,15 @@ simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
18221822
/*
18231823
*heap_mark4update- mark a tuple for update
18241824
*/
1825-
int
1825+
HTSU_Result
18261826
heap_mark4update(Relationrelation,HeapTupletuple,Buffer*buffer,
18271827
CommandIdcid)
18281828
{
18291829
TransactionIdxid=GetCurrentTransactionId();
18301830
ItemPointertid=&(tuple->t_self);
18311831
ItemIdlp;
18321832
PageHeaderdp;
1833-
intresult;
1833+
HTSU_Resultresult;
18341834

18351835
*buffer=ReadBuffer(relation,ItemPointerGetBlockNumber(tid));
18361836
LockBuffer(*buffer,BUFFER_LOCK_EXCLUSIVE);

‎src/backend/commands/async.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.119 2005/01/27 23:23:54 neilc Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.120 2005/03/20 23:40:24 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -521,7 +521,7 @@ AtCommit_Notify(void)
521521
elseif (listener->notification==0)
522522
{
523523
ItemPointerDatactid;
524-
intresult;
524+
HTSU_Resultresult;
525525

526526
rTuple=heap_modifytuple(lTuple,tdesc,
527527
value,nulls,repl);

‎src/backend/commands/trigger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.177 2004/12/31 21:59:41 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.178 2005/03/20 23:40:24 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1566,7 +1566,7 @@ GetTupleForTrigger(EState *estate, ResultRelInfo *relinfo,
15661566

15671567
if (newSlot!=NULL)
15681568
{
1569-
inttest;
1569+
HTSU_Resulttest;
15701570

15711571
/*
15721572
* mark tuple for update

‎src/backend/executor/execMain.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.242 2005/03/16 21:38:06 tgl Exp $
29+
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.243 2005/03/20 23:40:25 neilc Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -1116,7 +1116,7 @@ lnext:;
11161116
Bufferbuffer;
11171117
HeapTupleDatatuple;
11181118
TupleTableSlot*newSlot;
1119-
inttest;
1119+
HTSU_Resulttest;
11201120

11211121
if (!ExecGetJunkAttribute(junkfilter,
11221122
slot,
@@ -1396,7 +1396,7 @@ ExecDelete(TupleTableSlot *slot,
13961396
ResultRelInfo*resultRelInfo;
13971397
RelationresultRelationDesc;
13981398
ItemPointerDatactid;
1399-
intresult;
1399+
HTSU_Resultresult;
14001400

14011401
/*
14021402
* get information on the (current) result relation
@@ -1500,7 +1500,7 @@ ExecUpdate(TupleTableSlot *slot,
15001500
ResultRelInfo*resultRelInfo;
15011501
RelationresultRelationDesc;
15021502
ItemPointerDatactid;
1503-
intresult;
1503+
HTSU_Resultresult;
15041504
intnumIndices;
15051505

15061506
/*

‎src/backend/utils/time/tqual.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Portions Copyright (c) 1994, Regents of the University of California
1717
*
1818
* IDENTIFICATION
19-
* $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.85 2005/02/2015:01:42 momjian Exp $
19+
* $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.86 2005/03/2023:40:27 neilc Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -455,7 +455,7 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple, Buffer buffer)
455455
*tuples of my own xact are tested against the passed CommandId not
456456
*CurrentCommandId.
457457
*/
458-
int
458+
HTSU_Result
459459
HeapTupleSatisfiesUpdate(HeapTupleHeadertuple,CommandIdcurcid,
460460
Bufferbuffer)
461461
{

‎src/include/access/heapam.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.96 2005/03/16 21:38:09 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.97 2005/03/20 23:40:29 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -153,11 +153,11 @@ extern ItemPointer heap_get_latest_tid(Relation relation, Snapshot snapshot,
153153
externvoidsetLastTid(constItemPointertid);
154154

155155
externOidheap_insert(Relationrelation,HeapTupletup,CommandIdcid);
156-
externintheap_delete(Relationrelation,ItemPointertid,ItemPointerctid,
156+
externHTSU_Resultheap_delete(Relationrelation,ItemPointertid,ItemPointerctid,
157157
CommandIdcid,Snapshotcrosscheck,boolwait);
158-
externintheap_update(Relationrelation,ItemPointerotid,HeapTupletup,
158+
externHTSU_Resultheap_update(Relationrelation,ItemPointerotid,HeapTupletup,
159159
ItemPointerctid,CommandIdcid,Snapshotcrosscheck,boolwait);
160-
externintheap_mark4update(Relationrelation,HeapTupletup,
160+
externHTSU_Resultheap_mark4update(Relationrelation,HeapTupletup,
161161
Buffer*userbuf,CommandIdcid);
162162

163163
externOidsimple_heap_insert(Relationrelation,HeapTupletup);

‎src/include/utils/tqual.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/utils/tqual.h,v 1.55 2004/12/31 22:03:46 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/include/utils/tqual.h,v 1.56 2005/03/20 23:40:34 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -97,11 +97,14 @@ extern TransactionId RecentGlobalXmin;
9797
)
9898

9999
/* Result codes for HeapTupleSatisfiesUpdate */
100-
#defineHeapTupleMayBeUpdated0
101-
#defineHeapTupleInvisible1
102-
#defineHeapTupleSelfUpdated2
103-
#defineHeapTupleUpdated3
104-
#defineHeapTupleBeingUpdated4
100+
typedefenum
101+
{
102+
HeapTupleMayBeUpdated,
103+
HeapTupleInvisible,
104+
HeapTupleSelfUpdated,
105+
HeapTupleUpdated,
106+
HeapTupleBeingUpdated
107+
}HTSU_Result;
105108

106109
/* Result codes for HeapTupleSatisfiesVacuum */
107110
typedefenum
@@ -119,7 +122,7 @@ extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Buffer buffer);
119122
externboolHeapTupleSatisfiesToast(HeapTupleHeadertuple,Bufferbuffer);
120123
externboolHeapTupleSatisfiesSnapshot(HeapTupleHeadertuple,
121124
Snapshotsnapshot,Bufferbuffer);
122-
externintHeapTupleSatisfiesUpdate(HeapTupleHeadertuple,
125+
externHTSU_ResultHeapTupleSatisfiesUpdate(HeapTupleHeadertuple,
123126
CommandIdcurcid,Bufferbuffer);
124127
externHTSV_ResultHeapTupleSatisfiesVacuum(HeapTupleHeadertuple,
125128
TransactionIdOldestXmin,Bufferbuffer);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp