fix my old fault.

This commit is contained in:
Hiroshi Inoue 2001-08-09 19:22:24 +00:00
parent 1dcabacd45
commit 59e0a858f9
4 changed files with 24 additions and 17 deletions

View file

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.113.2.1 2001/05/17 00:48:45 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.113.2.2 2001/08/09 19:22:24 inoue Exp $
*
*
* INTERFACE ROUTINES
@ -1256,7 +1256,8 @@ heap_get_latest_tid(Relation relation,
{
if (linkend)
return NULL;
return heap_get_latest_tid(relation, snapshot, &ctid);
heap_get_latest_tid(relation, snapshot, &ctid);
*tid = ctid;
}
return tid;

View file

@ -27,7 +27,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.139.2.1 2001/05/15 00:34:02 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.139.2.2 2001/08/09 19:22:24 inoue Exp $
*
*-------------------------------------------------------------------------
*/
@ -1255,6 +1255,7 @@ ExecAppend(TupleTableSlot *slot,
* insert the tuple
*/
newId = heap_insert(resultRelationDesc, tuple);
setLastTid(&(tuple->t_self));
IncrAppended();
(estate->es_processed)++;

View file

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.24 2001/03/22 03:59:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.24.2.1 2001/08/09 19:22:24 inoue Exp $
*
* NOTES
* input routine largely stolen from boxin().
@ -124,22 +124,29 @@ tidne(PG_FUNCTION_ARGS)
*
* Maybe these implementations should be moved to another place
*/
static ItemPointerData Current_last_tid = { {0, 0}, 0};
void setLastTid(const ItemPointer tid)
{
Current_last_tid = *tid;
}
Datum
currtid_byreloid(PG_FUNCTION_ARGS)
{
Oid reloid = PG_GETARG_OID(0);
ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
ItemPointer result,
ret;
ItemPointer result;
Relation rel;
result = (ItemPointer) palloc(sizeof(ItemPointerData));
ItemPointerSetInvalid(result);
if (!reloid)
{
*result = Current_last_tid;
PG_RETURN_ITEMPOINTER(result);
}
ItemPointerCopy(tid, result);
if ((rel = heap_open(reloid, AccessShareLock)) != NULL)
{
ret = heap_get_latest_tid(rel, SnapshotNow, tid);
if (ret)
ItemPointerCopy(ret, result);
heap_get_latest_tid(rel, SnapshotNow, result);
heap_close(rel, AccessShareLock);
}
else
@ -153,8 +160,7 @@ currtid_byrelname(PG_FUNCTION_ARGS)
{
text *relname = PG_GETARG_TEXT_P(0);
ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
ItemPointer result,
ret;
ItemPointer result;
char *str;
Relation rel;
@ -162,12 +168,10 @@ currtid_byrelname(PG_FUNCTION_ARGS)
PointerGetDatum(relname)));
result = (ItemPointer) palloc(sizeof(ItemPointerData));
ItemPointerSetInvalid(result);
ItemPointerCopy(tid, result);
if ((rel = heap_openr(str, AccessShareLock)) != NULL)
{
ret = heap_get_latest_tid(rel, SnapshotNow, tid);
if (ret)
ItemPointerCopy(ret, result);
heap_get_latest_tid(rel, SnapshotNow, result);
heap_close(rel, AccessShareLock);
}
else

View file

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: heapam.h,v 1.63 2001/03/22 04:00:27 momjian Exp $
* $Id: heapam.h,v 1.63.2.1 2001/08/09 19:22:24 inoue Exp $
*
*-------------------------------------------------------------------------
*/
@ -204,6 +204,7 @@ extern void heap_endscan(HeapScanDesc scan);
extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw);
extern void heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tup, Buffer *userbuf);
extern ItemPointer heap_get_latest_tid(Relation relation, Snapshot snapshot, ItemPointer tid);
extern void setLastTid(const ItemPointer tid);
extern Oid heap_insert(Relation relation, HeapTuple tup);
extern int heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid);
extern int heap_update(Relation relation, ItemPointer otid, HeapTuple tup,