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

Commit59e0a85

Browse files
author
Hiroshi Inoue
committed
fix my old fault.
1 parent1dcabac commit59e0a85

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.113.2.1 2001/05/17 00:48:45 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.113.2.2 2001/08/09 19:22:24 inoue Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1256,7 +1256,8 @@ heap_get_latest_tid(Relation relation,
12561256
{
12571257
if (linkend)
12581258
returnNULL;
1259-
returnheap_get_latest_tid(relation,snapshot,&ctid);
1259+
heap_get_latest_tid(relation,snapshot,&ctid);
1260+
*tid=ctid;
12601261
}
12611262

12621263
returntid;

‎src/backend/executor/execMain.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
*
2929
* IDENTIFICATION
30-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.139.2.1 2001/05/15 00:34:02 tgl Exp $
30+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.139.2.2 2001/08/09 19:22:24 inoue Exp $
3131
*
3232
*-------------------------------------------------------------------------
3333
*/
@@ -1255,6 +1255,7 @@ ExecAppend(TupleTableSlot *slot,
12551255
* insert the tuple
12561256
*/
12571257
newId=heap_insert(resultRelationDesc,tuple);
1258+
setLastTid(&(tuple->t_self));
12581259

12591260
IncrAppended();
12601261
(estate->es_processed)++;

‎src/backend/utils/adt/tid.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.24 2001/03/22 03:59:54 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.24.2.1 2001/08/09 19:22:24 inoue Exp $
1212
*
1313
* NOTES
1414
* input routine largely stolen from boxin().
@@ -124,22 +124,29 @@ tidne(PG_FUNCTION_ARGS)
124124
*
125125
*Maybe these implementations should be moved to another place
126126
*/
127+
staticItemPointerDataCurrent_last_tid= { {0,0},0};
128+
voidsetLastTid(constItemPointertid)
129+
{
130+
Current_last_tid=*tid;
131+
}
127132
Datum
128133
currtid_byreloid(PG_FUNCTION_ARGS)
129134
{
130135
Oidreloid=PG_GETARG_OID(0);
131136
ItemPointertid=PG_GETARG_ITEMPOINTER(1);
132-
ItemPointerresult,
133-
ret;
137+
ItemPointerresult;
134138
Relationrel;
135139

136140
result= (ItemPointer)palloc(sizeof(ItemPointerData));
137-
ItemPointerSetInvalid(result);
141+
if (!reloid)
142+
{
143+
*result=Current_last_tid;
144+
PG_RETURN_ITEMPOINTER(result);
145+
}
146+
ItemPointerCopy(tid,result);
138147
if ((rel=heap_open(reloid,AccessShareLock))!=NULL)
139148
{
140-
ret=heap_get_latest_tid(rel,SnapshotNow,tid);
141-
if (ret)
142-
ItemPointerCopy(ret,result);
149+
heap_get_latest_tid(rel,SnapshotNow,result);
143150
heap_close(rel,AccessShareLock);
144151
}
145152
else
@@ -153,21 +160,18 @@ currtid_byrelname(PG_FUNCTION_ARGS)
153160
{
154161
text*relname=PG_GETARG_TEXT_P(0);
155162
ItemPointertid=PG_GETARG_ITEMPOINTER(1);
156-
ItemPointerresult,
157-
ret;
163+
ItemPointerresult;
158164
char*str;
159165
Relationrel;
160166

161167
str=DatumGetCString(DirectFunctionCall1(textout,
162168
PointerGetDatum(relname)));
163169

164170
result= (ItemPointer)palloc(sizeof(ItemPointerData));
165-
ItemPointerSetInvalid(result);
171+
ItemPointerCopy(tid,result);
166172
if ((rel=heap_openr(str,AccessShareLock))!=NULL)
167173
{
168-
ret=heap_get_latest_tid(rel,SnapshotNow,tid);
169-
if (ret)
170-
ItemPointerCopy(ret,result);
174+
heap_get_latest_tid(rel,SnapshotNow,result);
171175
heap_close(rel,AccessShareLock);
172176
}
173177
else

‎src/include/access/heapam.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: heapam.h,v 1.63 2001/03/22 04:00:27 momjian Exp $
10+
* $Id: heapam.h,v 1.63.2.1 2001/08/09 19:22:24 inoue Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -204,6 +204,7 @@ extern void heap_endscan(HeapScanDesc scan);
204204
externHeapTupleheap_getnext(HeapScanDescscandesc,intbackw);
205205
externvoidheap_fetch(Relationrelation,Snapshotsnapshot,HeapTupletup,Buffer*userbuf);
206206
externItemPointerheap_get_latest_tid(Relationrelation,Snapshotsnapshot,ItemPointertid);
207+
externvoidsetLastTid(constItemPointertid);
207208
externOidheap_insert(Relationrelation,HeapTupletup);
208209
externintheap_delete(Relationrelation,ItemPointertid,ItemPointerctid);
209210
externintheap_update(Relationrelation,ItemPointerotid,HeapTupletup,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp