mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
Use Snapshot in heap access methods.
This commit is contained in:
parent
f7f989c990
commit
be8300b18f
@ -170,7 +170,7 @@ gistbuild(Relation heap,
|
||||
econtext = NULL;
|
||||
}
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(scan, 0, &buffer);
|
||||
|
||||
/* int the tuples as we insert them */
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.18 1998/02/26 04:29:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.19 1998/07/27 19:37:35 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@ -121,7 +121,7 @@ hashbuild(Relation heap,
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
|
||||
/* start a heap scan */
|
||||
hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(hscan, 0, &buffer);
|
||||
|
||||
/* build the index */
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.30 1998/07/20 16:56:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.31 1998/07/27 19:37:36 vadim Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -209,7 +209,7 @@ heapgettup(Relation relation,
|
||||
ItemPointer tid,
|
||||
int dir,
|
||||
Buffer *b,
|
||||
bool seeself,
|
||||
Snapshot snapshot,
|
||||
int nkeys,
|
||||
ScanKey key)
|
||||
{
|
||||
@ -250,9 +250,9 @@ heapgettup(Relation relation,
|
||||
}
|
||||
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
|
||||
|
||||
elog(DEBUG, "heapgettup: relation(%c)=`%s', %s",
|
||||
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
|
||||
relation->rd_rel->relkind, &relation->rd_rel->relname,
|
||||
(seeself == true) ? "SeeSelf" : "NoSeeSelf");
|
||||
snapshot);
|
||||
#endif /* !defined(HEAPDEBUGALL) */
|
||||
|
||||
if (!ItemPointerIsValid(tid))
|
||||
@ -402,7 +402,7 @@ heapgettup(Relation relation,
|
||||
* ----------------
|
||||
*/
|
||||
HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
|
||||
seeself, nkeys, key, rtup);
|
||||
snapshot, nkeys, key, rtup);
|
||||
if (rtup != NULL)
|
||||
{
|
||||
ItemPointer iptr = &(rtup->t_ctid);
|
||||
@ -580,7 +580,7 @@ heap_close(Relation relation)
|
||||
HeapScanDesc
|
||||
heap_beginscan(Relation relation,
|
||||
int atend,
|
||||
bool seeself,
|
||||
Snapshot snapshot,
|
||||
unsigned nkeys,
|
||||
ScanKey key)
|
||||
{
|
||||
@ -608,7 +608,7 @@ heap_beginscan(Relation relation,
|
||||
|
||||
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
|
||||
if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
|
||||
seeself = true;
|
||||
snapshot = SnapshotSelf;
|
||||
|
||||
/* ----------------
|
||||
* increment relation ref count while scanning relation
|
||||
@ -639,7 +639,7 @@ heap_beginscan(Relation relation,
|
||||
initsdesc(sdesc, relation, atend, nkeys, key);
|
||||
|
||||
sdesc->rs_atend = atend;
|
||||
sdesc->rs_seeself = seeself;
|
||||
sdesc->rs_snapshot = snapshot;
|
||||
sdesc->rs_nkeys = (short) nkeys;
|
||||
|
||||
return (sdesc);
|
||||
@ -856,7 +856,7 @@ heap_getnext(HeapScanDesc scandesc,
|
||||
iptr,
|
||||
-1,
|
||||
&(sdesc->rs_cbuf),
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
}
|
||||
@ -943,7 +943,7 @@ heap_getnext(HeapScanDesc scandesc,
|
||||
iptr,
|
||||
1,
|
||||
&sdesc->rs_cbuf,
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
}
|
||||
@ -988,7 +988,7 @@ heap_getnext(HeapScanDesc scandesc,
|
||||
*/
|
||||
HeapTuple
|
||||
heap_fetch(Relation relation,
|
||||
bool seeself,
|
||||
Snapshot snapshot,
|
||||
ItemPointer tid,
|
||||
Buffer *b)
|
||||
{
|
||||
@ -1050,7 +1050,7 @@ heap_fetch(Relation relation,
|
||||
*/
|
||||
|
||||
HeapTupleSatisfies(lp, relation, buffer, dp,
|
||||
seeself, 0, (ScanKey) NULL, tuple);
|
||||
snapshot, 0, (ScanKey) NULL, tuple);
|
||||
|
||||
if (tuple == NULL)
|
||||
{
|
||||
@ -1447,7 +1447,7 @@ heap_markpos(HeapScanDesc sdesc)
|
||||
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
||||
-1,
|
||||
&sdesc->rs_pbuf,
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
|
||||
@ -1461,7 +1461,7 @@ heap_markpos(HeapScanDesc sdesc)
|
||||
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
||||
1,
|
||||
&sdesc->rs_nbuf,
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.20 1998/06/15 19:27:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.21 1998/07/27 19:37:37 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -501,7 +501,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(operatorObjectId));
|
||||
|
||||
scan = heap_beginscan(operatorRelation, false, false,
|
||||
scan = heap_beginscan(operatorRelation, false, SnapshotNow,
|
||||
1, &scanKeyData);
|
||||
|
||||
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||
@ -558,7 +558,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
ObjectIdGetDatum(indexObjectId));
|
||||
|
||||
relation = heap_openr(IndexRelationName);
|
||||
scan = heap_beginscan(relation, false, false, 1, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
|
||||
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "IndexSupportInitialize: corrupted catalogs");
|
||||
@ -618,7 +618,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
entry[1].sk_argument =
|
||||
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
|
||||
|
||||
scan = heap_beginscan(relation, false, false, 2, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
|
||||
|
||||
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||
HeapTupleIsValid(tuple))
|
||||
@ -661,7 +661,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
|
||||
ScanKeyEntrySetIllegal(StrategyMapGetScanKeyEntry(map, strategy));
|
||||
|
||||
scan = heap_beginscan(relation, false, false, 2, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
|
||||
|
||||
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||
HeapTupleIsValid(tuple))
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.26 1998/06/15 19:27:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.27 1998/07/27 19:37:39 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -120,7 +120,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
|
||||
{ /* they're equal */
|
||||
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
|
||||
itup = &(btitem->bti_itup);
|
||||
htup = heap_fetch(heapRel, true, &(itup->t_tid), NULL);
|
||||
htup = heap_fetch(heapRel, SnapshotSelf, &(itup->t_tid), NULL);
|
||||
if (htup != (HeapTuple) NULL)
|
||||
{ /* it is a duplicate */
|
||||
elog(ERROR, "Cannot insert a duplicate key into a unique index");
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.26 1998/06/15 19:27:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.27 1998/07/27 19:37:40 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@ -153,7 +153,7 @@ btbuild(Relation heap,
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
|
||||
/* start a heap scan */
|
||||
hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(hscan, 0, &buffer);
|
||||
|
||||
/* build the index */
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.24 1998/06/15 19:28:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.25 1998/07/27 19:37:41 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -164,7 +164,7 @@ rtbuild(Relation heap,
|
||||
slot = NULL;
|
||||
}
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(scan, 0, &buffer);
|
||||
|
||||
/* count the tuples as we insert them */
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.46 1998/07/26 04:30:19 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.47 1998/07/27 19:37:43 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,13 +41,8 @@
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_attribute_mb.h"
|
||||
#include "catalog/pg_class_mb.h"
|
||||
#else
|
||||
#include "catalog/pg_attribute.h"
|
||||
#include "catalog/pg_class.h"
|
||||
#endif
|
||||
#include "catalog/pg_type.h"
|
||||
#include "executor/execdesc.h"
|
||||
#include "executor/hashjoin.h"
|
||||
@ -464,14 +459,14 @@ boot_openrel(char *relname)
|
||||
{
|
||||
StartPortalAllocMode(DefaultAllocMode, 0);
|
||||
rdesc = heap_openr(TypeRelationName);
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
|
||||
heap_endscan(sdesc);
|
||||
app = Typ = ALLOC(struct typmap *, i + 1);
|
||||
while (i-- > 0)
|
||||
*app++ = ALLOC(struct typmap, 1);
|
||||
*app = (struct typmap *) NULL;
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
app = Typ;
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||
{
|
||||
@ -817,7 +812,7 @@ gettype(char *type)
|
||||
if (DebugMode)
|
||||
printf("bootstrap.c: External Type: %s\n", type);
|
||||
rdesc = heap_openr(TypeRelationName);
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
i = 0;
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||
++i;
|
||||
@ -826,7 +821,7 @@ gettype(char *type)
|
||||
while (i-- > 0)
|
||||
*app++ = ALLOC(struct typmap, 1);
|
||||
*app = (struct typmap *) NULL;
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
app = Typ;
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.11 1998/06/15 19:28:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.12 1998/07/27 19:37:45 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* See acl.h.
|
||||
@ -126,7 +126,7 @@ ChangeAcl(char *relname,
|
||||
relkey[0].sk_argument = NameGetDatum(relname);
|
||||
hsdp = heap_beginscan(relation,
|
||||
0,
|
||||
false,
|
||||
SnapshotNow,
|
||||
(unsigned) 1,
|
||||
relkey);
|
||||
htp = heap_getnext(hsdp, 0, &buffer);
|
||||
@ -482,7 +482,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
|
||||
&relkey[0].sk_func,
|
||||
&relkey[0].sk_nargs);
|
||||
relkey[0].sk_argument = NameGetDatum(relname);
|
||||
hsdp = heap_beginscan(relation, 0, false, 1, relkey);
|
||||
hsdp = heap_beginscan(relation, 0, SnapshotNow, 1, relkey);
|
||||
htp = heap_getnext(hsdp, 0, (Buffer *) 0);
|
||||
if (HeapTupleIsValid(htp) &&
|
||||
!heap_attisnull(htp, Anum_pg_class_relacl))
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.54 1998/07/20 19:21:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.55 1998/07/27 19:37:46 vadim Exp $
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
* heap_create() - Create an uncataloged heap relation
|
||||
@ -502,7 +502,7 @@ RelationAlreadyExists(Relation pg_class_desc, char relname[])
|
||||
*/
|
||||
pg_class_scan = heap_beginscan(pg_class_desc,
|
||||
0,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&key);
|
||||
|
||||
@ -896,7 +896,7 @@ RelationRemoveInheritance(Relation relation)
|
||||
|
||||
scan = heap_beginscan(catalogRelation,
|
||||
false,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&entry);
|
||||
|
||||
@ -924,7 +924,7 @@ RelationRemoveInheritance(Relation relation)
|
||||
|
||||
scan = heap_beginscan(catalogRelation,
|
||||
false,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&entry);
|
||||
|
||||
@ -950,7 +950,7 @@ RelationRemoveInheritance(Relation relation)
|
||||
|
||||
scan = heap_beginscan(catalogRelation,
|
||||
false,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&entry);
|
||||
|
||||
@ -987,7 +987,7 @@ RelationRemoveIndexes(Relation relation)
|
||||
|
||||
scan = heap_beginscan(indexRelation,
|
||||
false,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&entry);
|
||||
|
||||
@ -1033,7 +1033,7 @@ DeletePgRelationTuple(Relation rdesc)
|
||||
|
||||
pg_class_scan = heap_beginscan(pg_class_desc,
|
||||
0,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&key);
|
||||
|
||||
@ -1097,7 +1097,7 @@ DeletePgAttributeTuples(Relation rdesc)
|
||||
|
||||
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
|
||||
0,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&key);
|
||||
|
||||
@ -1166,7 +1166,7 @@ DeletePgTypeTuple(Relation rdesc)
|
||||
|
||||
pg_type_scan = heap_beginscan(pg_type_desc,
|
||||
0,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&key);
|
||||
|
||||
@ -1202,7 +1202,7 @@ DeletePgTypeTuple(Relation rdesc)
|
||||
|
||||
pg_attribute_scan = heap_beginscan(pg_attribute_desc,
|
||||
0,
|
||||
false,
|
||||
SnapshotNow,
|
||||
1,
|
||||
&attkey);
|
||||
|
||||
@ -1646,7 +1646,7 @@ RemoveAttrDefault(Relation rel)
|
||||
|
||||
RelationSetLockForWrite(adrel);
|
||||
|
||||
adscan = heap_beginscan(adrel, 0, false, 1, &key);
|
||||
adscan = heap_beginscan(adrel, 0, SnapshotNow, 1, &key);
|
||||
|
||||
while (tup = heap_getnext(adscan, 0, (Buffer *) NULL), PointerIsValid(tup))
|
||||
heap_delete(adrel, &tup->t_ctid);
|
||||
@ -1673,7 +1673,7 @@ RemoveRelCheck(Relation rel)
|
||||
|
||||
RelationSetLockForWrite(rcrel);
|
||||
|
||||
rcscan = heap_beginscan(rcrel, 0, false, 1, &key);
|
||||
rcscan = heap_beginscan(rcrel, 0, SnapshotNow, 1, &key);
|
||||
|
||||
while (tup = heap_getnext(rcscan, 0, (Buffer *) NULL), PointerIsValid(tup))
|
||||
heap_delete(rcrel, &tup->t_ctid);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.46 1998/07/20 19:21:42 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.47 1998/07/27 19:37:47 vadim Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -180,7 +180,7 @@ RelationNameGetObjectId(char *relationName,
|
||||
F_NAMEEQ,
|
||||
PointerGetDatum(relationName));
|
||||
|
||||
pg_class_scan = heap_beginscan(pg_class, 0, false, 1, &key);
|
||||
pg_class_scan = heap_beginscan(pg_class, 0, SnapshotNow, 1, &key);
|
||||
|
||||
/* ----------------
|
||||
* if we find the named relation, fetch its relation id
|
||||
@ -506,7 +506,7 @@ AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
|
||||
* ----------------
|
||||
*/
|
||||
pg_am_desc = heap_openr(AccessMethodRelationName);
|
||||
pg_am_scan = heap_beginscan(pg_am_desc, 0, false, 1, &key);
|
||||
pg_am_scan = heap_beginscan(pg_am_desc, 0, SnapshotNow, 1, &key);
|
||||
|
||||
pg_am_tuple = heap_getnext(pg_am_scan, 0, (Buffer *) NULL);
|
||||
|
||||
@ -945,7 +945,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(indexoid));
|
||||
|
||||
scan = heap_beginscan(pg_index, 0, false, 1, &entry);
|
||||
scan = heap_beginscan(pg_index, 0, SnapshotNow, 1, &entry);
|
||||
tuple = heap_getnext(scan, 0, &buffer);
|
||||
heap_endscan(scan);
|
||||
|
||||
@ -1238,7 +1238,7 @@ index_destroy(Oid indexId)
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(indexId));;
|
||||
|
||||
scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
|
||||
scan = heap_beginscan(catalogRelation, 0, SnapshotNow, 1, &entry);
|
||||
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||
|
||||
AssertState(HeapTupleIsValid(tuple));
|
||||
@ -1255,7 +1255,7 @@ index_destroy(Oid indexId)
|
||||
|
||||
entry.sk_attno = Anum_pg_attribute_attrelid;
|
||||
|
||||
scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
|
||||
scan = heap_beginscan(catalogRelation, 0, SnapshotNow, 1, &entry);
|
||||
|
||||
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||
HeapTupleIsValid(tuple))
|
||||
@ -1271,7 +1271,7 @@ index_destroy(Oid indexId)
|
||||
|
||||
entry.sk_attno = Anum_pg_index_indexrelid;
|
||||
|
||||
scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
|
||||
scan = heap_beginscan(catalogRelation, 0, SnapshotNow, 1, &entry);
|
||||
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
@ -1402,7 +1402,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
|
||||
key[0].sk_argument = ObjectIdGetDatum(relid);
|
||||
|
||||
pg_class_scan =
|
||||
heap_beginscan(pg_class, 0, false, 1, key);
|
||||
heap_beginscan(pg_class, 0, SnapshotNow, 1, key);
|
||||
|
||||
if (!HeapScanIsValid(pg_class_scan))
|
||||
{
|
||||
@ -1598,7 +1598,7 @@ DefaultBuild(Relation heapRelation,
|
||||
*/
|
||||
scan = heap_beginscan(heapRelation, /* relation */
|
||||
0, /* start at end */
|
||||
false,/* seeself */
|
||||
SnapshotNow,/* seeself */
|
||||
0, /* number of keys */
|
||||
(ScanKey) NULL); /* scan key */
|
||||
|
||||
@ -1812,7 +1812,7 @@ IndexIsUniqueNoCache(Oid indexId)
|
||||
(RegProcedure) F_OIDEQ,
|
||||
ObjectIdGetDatum(indexId));
|
||||
|
||||
scandesc = heap_beginscan(pg_index, 0, true, 1, skey);
|
||||
scandesc = heap_beginscan(pg_index, 0, SnapshotSelf, 1, skey);
|
||||
|
||||
tuple = heap_getnext(scandesc, 0, NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.18 1998/06/15 19:28:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.19 1998/07/27 19:37:48 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -241,7 +241,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
|
||||
ItemPointer iptr;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||
tuple = heap_fetch(heapRelation, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
}
|
||||
else
|
||||
@ -393,7 +393,7 @@ ProcedureNameIndexScan(Relation heapRelation,
|
||||
ItemPointer iptr;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||
tuple = heap_fetch(heapRelation, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (HeapTupleIsValid(tuple))
|
||||
{
|
||||
@ -458,7 +458,7 @@ ProcedureSrcIndexScan(Relation heapRelation, text *procSrc)
|
||||
ItemPointer iptr;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||
tuple = heap_fetch(heapRelation, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
}
|
||||
else
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.25 1998/05/09 23:43:00 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.26 1998/07/27 19:37:49 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* these routines moved here from commands/define.c and somewhat cleaned up.
|
||||
@ -120,7 +120,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
|
||||
*/
|
||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
3,
|
||||
opKey);
|
||||
|
||||
@ -705,7 +705,7 @@ OperatorDef(char *operatorName,
|
||||
|
||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
3,
|
||||
opKey);
|
||||
|
||||
@ -804,7 +804,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
|
||||
|
||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
1,
|
||||
opKey);
|
||||
|
||||
@ -894,7 +894,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
|
||||
|
||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
1,
|
||||
opKey);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.25 1998/06/15 19:28:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.26 1998/07/27 19:37:49 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -68,7 +68,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
|
||||
|
||||
scan = heap_beginscan(pg_type_desc,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
1,
|
||||
typeKey);
|
||||
|
||||
@ -470,7 +470,7 @@ TypeCreate(char *typeName,
|
||||
typeKey[0].sk_argument = PointerGetDatum(typeName);
|
||||
pg_type_scan = heap_beginscan(pg_type_desc,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
1,
|
||||
typeKey);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.35 1998/07/09 03:28:44 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.36 1998/07/27 19:37:50 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -203,7 +203,7 @@ Async_Notify(char *relname)
|
||||
lRel = heap_openr(ListenerRelationName);
|
||||
tdesc = RelationGetTupleDescriptor(lRel);
|
||||
RelationSetLockForWrite(lRel);
|
||||
sRel = heap_beginscan(lRel, 0, false, 1, &key);
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
|
||||
|
||||
nulls[0] = nulls[1] = nulls[2] = ' ';
|
||||
repl[0] = repl[1] = repl[2] = ' ';
|
||||
@ -283,7 +283,7 @@ Async_NotifyAtCommit()
|
||||
Int32GetDatum(1));
|
||||
lRel = heap_openr(ListenerRelationName);
|
||||
RelationSetLockForWrite(lRel);
|
||||
sRel = heap_beginscan(lRel, 0, false, 1, &key);
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, &key);
|
||||
tdesc = RelationGetTupleDescriptor(lRel);
|
||||
|
||||
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0, &b)))
|
||||
@ -431,7 +431,7 @@ Async_Listen(char *relname, int pid)
|
||||
|
||||
/* is someone already listening. One listener per relation */
|
||||
tdesc = RelationGetTupleDescriptor(lDesc);
|
||||
s = heap_beginscan(lDesc, 0, false, 0, (ScanKey) NULL);
|
||||
s = heap_beginscan(lDesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
|
||||
{
|
||||
d = heap_getattr(htup, Anum_pg_listener_relname, tdesc,
|
||||
@ -577,7 +577,7 @@ Async_NotifyFrontEnd()
|
||||
lRel = heap_openr(ListenerRelationName);
|
||||
RelationSetLockForWrite(lRel);
|
||||
tdesc = RelationGetTupleDescriptor(lRel);
|
||||
sRel = heap_beginscan(lRel, 0, false, 2, key);
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 2, key);
|
||||
|
||||
nulls[0] = nulls[1] = nulls[2] = ' ';
|
||||
repl[0] = repl[1] = repl[2] = ' ';
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.25 1998/07/26 04:30:22 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.26 1998/07/27 19:37:50 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -43,11 +43,7 @@
|
||||
#include <utils/excid.h>
|
||||
#include <utils/mcxt.h>
|
||||
#include <catalog/pg_proc.h>
|
||||
#ifdef MULTIBYTE
|
||||
#include <catalog/pg_class_mb.h>
|
||||
#else
|
||||
#include <catalog/pg_class.h>
|
||||
#endif
|
||||
#include <optimizer/internal.h>
|
||||
#ifndef NO_SECURITY
|
||||
#include <utils/acl.h>
|
||||
@ -358,7 +354,7 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
|
||||
{
|
||||
|
||||
HeapTid = &ScanResult->heap_iptr;
|
||||
LocalHeapTuple = heap_fetch(LocalOldHeap, false, HeapTid, &LocalBuffer);
|
||||
LocalHeapTuple = heap_fetch(LocalOldHeap, SnapshotNow, HeapTid, &LocalBuffer);
|
||||
OIDNewHeapInsert =
|
||||
heap_insert(LocalNewHeap, LocalHeapTuple);
|
||||
pfree(ScanResult);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.28 1998/06/15 19:28:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.29 1998/07/27 19:37:51 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The PortalExecutorHeapMemory crap needs to be eliminated
|
||||
@ -438,7 +438,7 @@ PerformAddAttribute(char *relationName,
|
||||
* XXX use syscache here as an optimization
|
||||
*/
|
||||
key[1].sk_argument = (Datum) colDef->colname;
|
||||
attsdesc = heap_beginscan(attrdesc, 0, false, 2, key);
|
||||
attsdesc = heap_beginscan(attrdesc, 0, SnapshotNow, 2, key);
|
||||
|
||||
|
||||
tup = heap_getnext(attsdesc, 0, (Buffer *) NULL);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.51 1998/07/26 04:30:23 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.52 1998/07/27 19:37:51 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -37,10 +37,6 @@
|
||||
#include "commands/trigger.h"
|
||||
#include <storage/fd.h>
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
#include "mb/pg_wchar.h"
|
||||
#endif
|
||||
|
||||
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
|
||||
#define VALUE(c) ((c) - '0')
|
||||
|
||||
@ -65,7 +61,7 @@ static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline
|
||||
static char *CopyReadAttribute(FILE *fp, bool *isnull, char *delim);
|
||||
|
||||
#endif
|
||||
static void CopyAttributeOut(FILE *fp, unsigned char *string, char *delim, int is_array);
|
||||
static void CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array);
|
||||
static int CountTuples(Relation relation);
|
||||
|
||||
extern FILE *Pfout,
|
||||
@ -225,7 +221,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
int32 ntuples;
|
||||
TupleDesc tupDesc;
|
||||
|
||||
scandesc = heap_beginscan(rel, 0, false, 0, NULL);
|
||||
scandesc = heap_beginscan(rel, 0, SnapshotNow, 0, NULL);
|
||||
|
||||
attr_count = rel->rd_att->natts;
|
||||
attr = rel->rd_att->attrs;
|
||||
@ -281,7 +277,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
{
|
||||
string = (char *) (*fmgr_faddr(&out_functions[i]))
|
||||
(value, elements[i], typmod[i]);
|
||||
CopyAttributeOut(fp, (unsigned char*)string, delim, attr[i]->attnelems);
|
||||
CopyAttributeOut(fp, string, delim, attr[i]->attnelems);
|
||||
pfree(string);
|
||||
}
|
||||
else
|
||||
@ -908,7 +904,7 @@ GetIndexRelations(Oid main_relation_oid,
|
||||
bool isnull;
|
||||
|
||||
pg_index_rel = heap_openr(IndexRelationName);
|
||||
scandesc = heap_beginscan(pg_index_rel, 0, false, 0, NULL);
|
||||
scandesc = heap_beginscan(pg_index_rel, 0, SnapshotNow, 0, NULL);
|
||||
tupDesc = RelationGetTupleDescriptor(pg_index_rel);
|
||||
|
||||
*n_indices = 0;
|
||||
@ -1016,17 +1012,6 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
|
||||
char c;
|
||||
int done = 0;
|
||||
int i = 0;
|
||||
#ifdef MULTIBYTE
|
||||
int mblen;
|
||||
int encoding;
|
||||
unsigned char s[2];
|
||||
int j;
|
||||
#endif
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
encoding = pg_get_client_encoding();
|
||||
s[1] = 0;
|
||||
#endif
|
||||
|
||||
#ifdef COPY_PATCH
|
||||
/* if last delimiter was a newline return a NULL attribute */
|
||||
@ -1044,9 +1029,9 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
|
||||
while (!done)
|
||||
{
|
||||
c = getc(fp);
|
||||
|
||||
if (feof(fp))
|
||||
return (NULL);
|
||||
|
||||
else if (c == '\\')
|
||||
{
|
||||
c = getc(fp);
|
||||
@ -1127,55 +1112,21 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
|
||||
#endif
|
||||
done = 1;
|
||||
}
|
||||
if (!done) {
|
||||
if (!done)
|
||||
attribute[i++] = c;
|
||||
#ifdef MULTIBYTE
|
||||
s[0] = c;
|
||||
mblen = pg_encoding_mblen(encoding, s);
|
||||
mblen--;
|
||||
for(j=0;j<mblen;j++) {
|
||||
c = getc(fp);
|
||||
if (feof(fp))
|
||||
return (NULL);
|
||||
attribute[i++] = c;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (i == EXT_ATTLEN - 1)
|
||||
elog(ERROR, "CopyReadAttribute - attribute length too long. line: %d", lineno);
|
||||
}
|
||||
attribute[i] = '\0';
|
||||
#ifdef MULTIBYTE
|
||||
return(pg_client_to_server((unsigned char*)attribute, strlen(attribute)));
|
||||
#else
|
||||
return (&attribute[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
CopyAttributeOut(FILE *fp, unsigned char *server_string, char *delim, int is_array)
|
||||
CopyAttributeOut(FILE *fp, char *string, char *delim, int is_array)
|
||||
{
|
||||
unsigned char *string;
|
||||
unsigned char c;
|
||||
#ifdef MULTIBYTE
|
||||
int mblen;
|
||||
int encoding;
|
||||
int i;
|
||||
#endif
|
||||
char c;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
string = pg_server_to_client(server_string, strlen(server_string));
|
||||
encoding = pg_get_client_encoding();
|
||||
#else
|
||||
string = server_string;
|
||||
#endif
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
for (; (mblen = pg_encoding_mblen(encoding, string)) &&
|
||||
((c = *string) != '\0'); string += mblen)
|
||||
#else
|
||||
for (; (c = *string) != '\0'; string++)
|
||||
#endif
|
||||
{
|
||||
if (c == delim[0] || c == '\n' ||
|
||||
(c == '\\' && !is_array))
|
||||
@ -1197,13 +1148,7 @@ CopyAttributeOut(FILE *fp, unsigned char *server_string, char *delim, int is_arr
|
||||
fputc('\\', fp);
|
||||
}
|
||||
}
|
||||
#ifdef MULTIBYTE
|
||||
for (i=0;i<mblen;i++) {
|
||||
fputc(*(string+i), fp);
|
||||
}
|
||||
#else
|
||||
fputc(*string, fp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1221,7 +1166,7 @@ CountTuples(Relation relation)
|
||||
|
||||
int i;
|
||||
|
||||
scandesc = heap_beginscan(relation, 0, false, 0, NULL);
|
||||
scandesc = heap_beginscan(relation, 0, SnapshotNow, 0, NULL);
|
||||
|
||||
for (tuple = heap_getnext(scandesc, 0, NULL), i = 0;
|
||||
tuple != NULL;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.17 1998/07/26 04:30:24 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.18 1998/07/27 19:37:52 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -22,11 +22,7 @@
|
||||
#include "access/htup.h"
|
||||
#include "access/relscan.h"
|
||||
#include "catalog/catname.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_database_mb.h"
|
||||
#else
|
||||
#include "catalog/pg_database.h"
|
||||
#endif
|
||||
#include "catalog/pg_shadow.h"
|
||||
#include "commands/dbcommands.h"
|
||||
#include "fmgr.h"
|
||||
@ -47,11 +43,7 @@ static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
|
||||
static void stop_vacuum(char *dbpath, char *dbname);
|
||||
|
||||
void
|
||||
#ifdef MULTIBYTE
|
||||
createdb(char *dbname, char *dbpath, int encoding)
|
||||
#else
|
||||
createdb(char *dbname, char *dbpath)
|
||||
#endif
|
||||
{
|
||||
Oid db_id,
|
||||
user_id;
|
||||
@ -98,13 +90,8 @@ createdb(char *dbname, char *dbpath)
|
||||
dbname, user_id, dbname);
|
||||
#endif
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
sprintf(buf, "insert into pg_database (datname, datdba, encoding, datpath)"
|
||||
" values (\'%s\', \'%d\', \'%d\', \'%s\');", dbname, user_id, encoding, loc);
|
||||
#else
|
||||
sprintf(buf, "insert into pg_database (datname, datdba, datpath)"
|
||||
" values (\'%s\', \'%d\', \'%s\');", dbname, user_id, loc);
|
||||
#endif
|
||||
|
||||
pg_exec_query(buf);
|
||||
}
|
||||
@ -168,7 +155,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
|
||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
||||
F_NAMEEQ, NameGetDatum(dbname));
|
||||
|
||||
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
|
||||
scan = heap_beginscan(dbrel, 0, SnapshotNow, 1, &scanKey);
|
||||
if (!HeapScanIsValid(scan))
|
||||
elog(ERROR, "%s: cannot begin scan of pg_database.", command);
|
||||
|
||||
|
@ -186,7 +186,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
|
||||
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_language_lanname,
|
||||
F_NAMEEQ, PointerGetDatum(languageName));
|
||||
|
||||
scanDesc = heap_beginscan(rdesc, 0, false, 1, &scanKeyData);
|
||||
scanDesc = heap_beginscan(rdesc, 0, SnapshotNow, 1, &scanKeyData);
|
||||
|
||||
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.25 1998/06/15 19:28:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.26 1998/07/27 19:37:53 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -97,7 +97,7 @@ RemoveOperator(char *operatorName, /* operator name */
|
||||
ObjectIdGetDatum(typeId2));
|
||||
|
||||
relation = heap_openr(OperatorRelationName);
|
||||
scan = heap_beginscan(relation, 0, false, 3, operatorKey);
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow, 3, operatorKey);
|
||||
tup = heap_getnext(scan, 0, &buffer);
|
||||
if (HeapTupleIsValid(tup))
|
||||
{
|
||||
@ -165,7 +165,7 @@ SingleOpOperatorRemove(Oid typeOid)
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
key[0].sk_attno = attnums[i];
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 1, key);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 1, key);
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
|
||||
{
|
||||
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
|
||||
@ -214,7 +214,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
||||
oidptr->next = NULL;
|
||||
optr = oidptr;
|
||||
rdesc = heap_openr(AttributeRelationName);
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 1, key);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 1, key);
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
|
||||
{
|
||||
ItemPointerCopy(&tup->t_ctid, &itemPointerData);
|
||||
@ -235,7 +235,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
||||
while (PointerIsValid((char *) optr->next))
|
||||
{
|
||||
key[0].sk_argument = (Datum) (optr++)->reloid;
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 1, key);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 1, key);
|
||||
tup = heap_getnext(sdesc, 0, &buffer);
|
||||
if (PointerIsValid(tup))
|
||||
{
|
||||
@ -285,7 +285,7 @@ RemoveType(char *typeName) /* type name to be removed */
|
||||
|
||||
typeKey[0].sk_argument = PointerGetDatum(typeName);
|
||||
|
||||
scan = heap_beginscan(relation, 0, false, 1, typeKey);
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow, 1, typeKey);
|
||||
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
@ -303,7 +303,7 @@ RemoveType(char *typeName) /* type name to be removed */
|
||||
shadow_type = makeArrayTypeName(typeName);
|
||||
typeKey[0].sk_argument = NameGetDatum(shadow_type);
|
||||
|
||||
scan = heap_beginscan(relation, 0, false,
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow,
|
||||
1, (ScanKey) typeKey);
|
||||
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
||||
|
||||
@ -390,7 +390,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
|
||||
key[0].sk_nargs = key[0].sk_func.fn_nargs;
|
||||
|
||||
relation = heap_openr(ProcedureRelationName);
|
||||
scan = heap_beginscan(relation, 0, false, 1, key);
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow, 1, key);
|
||||
|
||||
do
|
||||
{ /* hope this is ok because it's indexed */
|
||||
@ -493,7 +493,7 @@ RemoveAggregate(char *aggName, char *aggType)
|
||||
ObjectIdGetDatum(basetypeID));
|
||||
|
||||
relation = heap_openr(AggregateRelationName);
|
||||
scan = heap_beginscan(relation, 0, false, 2, aggregateKey);
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow, 2, aggregateKey);
|
||||
tup = heap_getnext(scan, 0, (Buffer *) 0);
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ CreateTrigger(CreateTrigStmt *stmt)
|
||||
RelationSetLockForWrite(tgrel);
|
||||
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
||||
F_OIDEQ, rel->rd_id);
|
||||
tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
|
||||
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
|
||||
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
|
||||
{
|
||||
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
|
||||
@ -275,7 +275,7 @@ DropTrigger(DropTrigStmt *stmt)
|
||||
RelationSetLockForWrite(tgrel);
|
||||
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
||||
F_OIDEQ, rel->rd_id);
|
||||
tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
|
||||
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
|
||||
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
|
||||
{
|
||||
Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
|
||||
@ -340,7 +340,7 @@ RelationRemoveTriggers(Relation rel)
|
||||
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
|
||||
F_OIDEQ, rel->rd_id);
|
||||
|
||||
tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
|
||||
tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key);
|
||||
|
||||
while (tup = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tup))
|
||||
heap_delete(tgrel, &tup->t_ctid);
|
||||
@ -391,7 +391,7 @@ RelationBuildTriggers(Relation relation)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(tgrel, false, iptr, &buffer);
|
||||
tuple = heap_fetch(tgrel, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
continue;
|
||||
|
@ -20,11 +20,7 @@
|
||||
|
||||
#include <miscadmin.h>
|
||||
#include <catalog/catname.h>
|
||||
#ifdef MULTIBYTE
|
||||
#include <catalog/pg_database_mb.h>
|
||||
#else
|
||||
#include <catalog/pg_database.h>
|
||||
#endif
|
||||
#include <catalog/pg_shadow.h>
|
||||
#include <libpq/crypt.h>
|
||||
#include <access/heapam.h>
|
||||
@ -138,7 +134,7 @@ DefineUser(CreateUserStmt *stmt)
|
||||
*/
|
||||
RelationSetLockForWrite(pg_shadow_rel);
|
||||
|
||||
scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
|
||||
scan = heap_beginscan(pg_shadow_rel, false, SnapshotNow, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
|
||||
@ -268,7 +264,7 @@ AlterUser(AlterUserStmt *stmt)
|
||||
*/
|
||||
RelationSetLockForWrite(pg_shadow_rel);
|
||||
|
||||
scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
|
||||
scan = heap_beginscan(pg_shadow_rel, false, SnapshotNow, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
|
||||
@ -397,7 +393,7 @@ RemoveUser(char *user)
|
||||
*/
|
||||
RelationSetLockForWrite(pg_shadow_rel);
|
||||
|
||||
scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
|
||||
scan = heap_beginscan(pg_shadow_rel, false, SnapshotNow, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_dsc, &n);
|
||||
@ -428,7 +424,7 @@ RemoveUser(char *user)
|
||||
pg_rel = heap_openr(DatabaseRelationName);
|
||||
pg_dsc = RelationGetTupleDescriptor(pg_rel);
|
||||
|
||||
scan = heap_beginscan(pg_rel, false, false, 0, NULL);
|
||||
scan = heap_beginscan(pg_rel, false, SnapshotNow, 0, NULL);
|
||||
while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
|
||||
{
|
||||
datum = heap_getattr(tuple, Anum_pg_database_datdba, pg_dsc, &n);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.68 1998/07/26 04:30:25 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.69 1998/07/27 19:37:53 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -27,11 +27,7 @@
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/index.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_class_mb.h"
|
||||
#else
|
||||
#include "catalog/pg_class.h"
|
||||
#endif
|
||||
#include "catalog/pg_index.h"
|
||||
#include "catalog/pg_operator.h"
|
||||
#include "catalog/pg_statistic.h"
|
||||
@ -297,7 +293,7 @@ vc_getrels(NameData *VacRelP)
|
||||
pgclass = heap_openr(RelationRelationName);
|
||||
pgcdesc = RelationGetTupleDescriptor(pgclass);
|
||||
|
||||
pgcscan = heap_beginscan(pgclass, false, false, 1, &pgckey);
|
||||
pgcscan = heap_beginscan(pgclass, false, SnapshotNow, 1, &pgckey);
|
||||
|
||||
while (HeapTupleIsValid(pgctup = heap_getnext(pgcscan, 0, &buf)))
|
||||
{
|
||||
@ -404,7 +400,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
|
||||
pgclass = heap_openr(RelationRelationName);
|
||||
pgcdesc = RelationGetTupleDescriptor(pgclass);
|
||||
pgcscan = heap_beginscan(pgclass, false, false, 1, &pgckey);
|
||||
pgcscan = heap_beginscan(pgclass, false, SnapshotNow, 1, &pgckey);
|
||||
|
||||
/*
|
||||
* Race condition -- if the pg_class tuple has gone away since the
|
||||
@ -1776,7 +1772,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
|
||||
ObjectIdGetDatum(relid));
|
||||
|
||||
rd = heap_openr(RelationRelationName);
|
||||
rsdesc = heap_beginscan(rd, false, false, 1, &rskey);
|
||||
rsdesc = heap_beginscan(rd, false, SnapshotNow, 1, &rskey);
|
||||
|
||||
if (!HeapTupleIsValid(rtup = heap_getnext(rsdesc, 0, &rbuf)))
|
||||
elog(ERROR, "pg_class entry for relid %d vanished during vacuuming",
|
||||
@ -1799,7 +1795,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
|
||||
ScanKeyEntryInitialize(&askey, 0, Anum_pg_attribute_attrelid,
|
||||
F_INT4EQ, relid);
|
||||
|
||||
asdesc = heap_beginscan(ad, false, false, 1, &askey);
|
||||
asdesc = heap_beginscan(ad, false, SnapshotNow, 1, &askey);
|
||||
|
||||
while (HeapTupleIsValid(atup = heap_getnext(asdesc, 0, &abuf)))
|
||||
{
|
||||
@ -1946,10 +1942,10 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
|
||||
ScanKeyEntryInitialize(&pgskey, 0x0, Anum_pg_statistic_starelid,
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(relid));
|
||||
pgsscan = heap_beginscan(pgstatistic, false, false, 1, &pgskey);
|
||||
pgsscan = heap_beginscan(pgstatistic, false, SnapshotNow, 1, &pgskey);
|
||||
}
|
||||
else
|
||||
pgsscan = heap_beginscan(pgstatistic, false, false, 0, NULL);
|
||||
pgsscan = heap_beginscan(pgstatistic, false, SnapshotNow, 0, NULL);
|
||||
|
||||
while (HeapTupleIsValid(pgstup = heap_getnext(pgsscan, 0, NULL)))
|
||||
{
|
||||
@ -2158,7 +2154,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(relid));
|
||||
|
||||
pgiscan = heap_beginscan(pgindex, false, false, 1, &pgikey);
|
||||
pgiscan = heap_beginscan(pgindex, false, SnapshotNow, 1, &pgikey);
|
||||
|
||||
while (HeapTupleIsValid(pgitup = heap_getnext(pgiscan, 0, NULL)))
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.23 1998/07/16 01:49:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.24 1998/07/27 19:37:54 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
static Pointer
|
||||
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
|
||||
bool isindex, ScanDirection dir);
|
||||
bool isindex, ScanDirection dir, Snapshot snapshot);
|
||||
static Relation ExecOpenR(Oid relationOid, bool isindex);
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -81,6 +81,7 @@ ExecOpenScanR(Oid relOid,
|
||||
ScanKey skeys,
|
||||
bool isindex,
|
||||
ScanDirection dir,
|
||||
Snapshot snapshot,
|
||||
Relation *returnRelation, /* return */
|
||||
Pointer *returnScanDesc) /* return */
|
||||
{
|
||||
@ -99,7 +100,8 @@ ExecOpenScanR(Oid relOid,
|
||||
nkeys,
|
||||
skeys,
|
||||
isindex,
|
||||
dir);
|
||||
dir,
|
||||
snapshot);
|
||||
|
||||
if (returnRelation != NULL)
|
||||
*returnRelation = relation;
|
||||
@ -153,7 +155,8 @@ ExecBeginScan(Relation relation,
|
||||
int nkeys,
|
||||
ScanKey skeys,
|
||||
bool isindex,
|
||||
ScanDirection dir)
|
||||
ScanDirection dir,
|
||||
Snapshot snapshot)
|
||||
{
|
||||
Pointer scanDesc;
|
||||
|
||||
@ -178,7 +181,7 @@ ExecBeginScan(Relation relation,
|
||||
{
|
||||
scanDesc = (Pointer) heap_beginscan(relation,
|
||||
ScanDirectionIsBackward(dir),
|
||||
false,
|
||||
snapshot,
|
||||
nkeys,
|
||||
skeys);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.50 1998/07/20 16:14:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.51 1998/07/27 19:37:55 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -124,6 +124,8 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
|
||||
palloc(queryDesc->plantree->nParamExec * sizeof(ParamExecData));
|
||||
memset(estate->es_param_exec_vals, 0, queryDesc->plantree->nParamExec * sizeof(ParamExecData));
|
||||
}
|
||||
|
||||
estate->es_snapshot = SnapshotNow;
|
||||
|
||||
result = InitPlan(queryDesc->operation,
|
||||
queryDesc->parsetree,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.33 1998/07/20 16:14:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.34 1998/07/27 19:37:56 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -750,7 +750,7 @@ ExecOpenIndices(Oid resultRelationOid,
|
||||
*/
|
||||
indexSd = heap_beginscan(indexRd, /* scan desc */
|
||||
false, /* scan backward flag */
|
||||
false, /* see self */
|
||||
SnapshotNow, /* NOW snapshot */
|
||||
1, /* number scan keys */
|
||||
&key); /* scan keys */
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.18 1998/06/15 19:28:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.19 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -85,7 +85,8 @@ IndexNext(IndexScan *node)
|
||||
EState *estate;
|
||||
CommonScanState *scanstate;
|
||||
IndexScanState *indexstate;
|
||||
ScanDirection direction;
|
||||
ScanDirection direction;
|
||||
Snapshot snapshot;
|
||||
int indexPtr;
|
||||
IndexScanDescPtr scanDescs;
|
||||
IndexScanDesc scandesc;
|
||||
@ -101,6 +102,7 @@ IndexNext(IndexScan *node)
|
||||
*/
|
||||
estate = node->scan.plan.state;
|
||||
direction = estate->es_direction;
|
||||
snapshot = estate->es_snapshot;
|
||||
scanstate = node->scan.scanstate;
|
||||
indexstate = node->indxstate;
|
||||
indexPtr = indexstate->iss_IndexPtr;
|
||||
@ -122,7 +124,8 @@ IndexNext(IndexScan *node)
|
||||
*/
|
||||
while ((result = index_getnext(scandesc, direction)) != NULL)
|
||||
{
|
||||
tuple = heap_fetch(heapRelation, false, &result->heap_iptr, &buffer);
|
||||
tuple = heap_fetch(heapRelation, snapshot,
|
||||
&result->heap_iptr, &buffer);
|
||||
/* be tidy */
|
||||
pfree(result);
|
||||
|
||||
@ -920,6 +923,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
(ScanKey) NULL, /* scan key */
|
||||
0, /* is index */
|
||||
direction, /* scan direction */
|
||||
estate->es_snapshot, /* */
|
||||
¤tRelation, /* return: rel desc */
|
||||
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
||||
|
||||
@ -958,6 +962,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
scanKeys[i], /* scan key */
|
||||
true, /* is index */
|
||||
direction, /* scan direction */
|
||||
estate->es_snapshot,
|
||||
&(relationDescs[i]), /* return: rel desc */
|
||||
(Pointer *) &(scanDescs[i]));
|
||||
/* return: scan desc */
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.13 1998/02/26 04:31:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.14 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -139,8 +139,7 @@ ExecMaterial(Material *node)
|
||||
*/
|
||||
currentScanDesc = heap_beginscan(currentRelation, /* relation */
|
||||
ScanDirectionIsBackward(dir),
|
||||
/* bkwd flag */
|
||||
false, /* seeself */
|
||||
SnapshotSelf, /* seeself */
|
||||
0, /* num scan keys */
|
||||
NULL); /* scan keys */
|
||||
matstate->csstate.css_currentRelation = currentRelation;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.10 1998/06/15 19:28:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.11 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -181,6 +181,7 @@ InitScanRelation(SeqScan *node, EState *estate,
|
||||
NULL, /* scan key */
|
||||
0, /* is index */
|
||||
direction,/* scan direction */
|
||||
estate->es_snapshot,
|
||||
¤tRelation, /* return: rel desc */
|
||||
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* ExecEndTee
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.18 1998/06/15 19:28:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.19 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -226,10 +226,11 @@ ExecCountSlotsTee(Tee *node)
|
||||
static void
|
||||
initTeeScanDescs(Tee *node)
|
||||
{
|
||||
TeeState *teeState;
|
||||
Relation bufferRel;
|
||||
ScanDirection dir;
|
||||
MemoryContext orig;
|
||||
TeeState *teeState;
|
||||
Relation bufferRel;
|
||||
ScanDirection dir;
|
||||
Snapshot snapshot;
|
||||
MemoryContext orig;
|
||||
|
||||
teeState = node->teestate;
|
||||
if (teeState->tee_leftScanDesc && teeState->tee_rightScanDesc)
|
||||
@ -241,23 +242,24 @@ initTeeScanDescs(Tee *node)
|
||||
bufferRel = teeState->tee_bufferRel;
|
||||
dir = ((Plan *) node)->state->es_direction; /* backwards not handled
|
||||
* yet XXX */
|
||||
snapshot = ((Plan *) node)->state->es_snapshot;
|
||||
|
||||
if (teeState->tee_leftScanDesc == NULL)
|
||||
{
|
||||
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
|
||||
ScanDirectionIsBackward(dir),
|
||||
false, /* seeself */
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
snapshot,
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
);
|
||||
}
|
||||
if (teeState->tee_rightScanDesc == NULL)
|
||||
{
|
||||
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
|
||||
ScanDirectionIsBackward(dir),
|
||||
false, /* seeself */
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
snapshot,
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.17 1998/07/18 04:22:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.18 1998/07/27 19:37:58 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -979,7 +979,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
||||
* will be used to find the associated strategy numbers for the test.
|
||||
* --Nels, Jan '93
|
||||
*/
|
||||
scan = heap_beginscan(relation, false, false, 2, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
|
||||
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
@ -1010,7 +1010,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(clause_op));
|
||||
|
||||
scan = heap_beginscan(relation, false, false, 3, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 3, entry);
|
||||
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
@ -1042,7 +1042,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
||||
F_INT2EQ,
|
||||
Int16GetDatum(test_strategy));
|
||||
|
||||
scan = heap_beginscan(relation, false, false, 3, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 3, entry);
|
||||
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.17 1998/06/15 19:28:49 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.18 1998/07/27 19:38:00 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -148,7 +148,7 @@ index_info(Query *root, bool first, int relid, IdxInfoRetval *info)
|
||||
ObjectIdGetDatum(indrelid));
|
||||
|
||||
relation = heap_openr(IndexRelationName);
|
||||
scan = heap_beginscan(relation, 0, false,
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow,
|
||||
1, &indexKey);
|
||||
}
|
||||
if (!HeapScanIsValid(scan))
|
||||
@ -413,7 +413,7 @@ find_inheritance_children(Oid inhparent)
|
||||
|
||||
key[0].sk_argument = ObjectIdGetDatum((Oid) inhparent);
|
||||
relation = heap_openr(InheritsRelationName);
|
||||
scan = heap_beginscan(relation, 0, false, 1, key);
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow, 1, key);
|
||||
while (HeapTupleIsValid(inheritsTuple =
|
||||
heap_getnext(scan, 0,
|
||||
(Buffer *) NULL)))
|
||||
@ -449,7 +449,7 @@ VersionGetParents(Oid verrelid)
|
||||
key[0].sk_nargs = key[0].sk_func.fn_nargs;
|
||||
relation = heap_openr(VersionRelationName);
|
||||
key[0].sk_argument = ObjectIdGetDatum(verrelid);
|
||||
scan = heap_beginscan(relation, 0, false, 1, key);
|
||||
scan = heap_beginscan(relation, 0, SnapshotNow, 1, key);
|
||||
for (;;)
|
||||
{
|
||||
versionTuple = heap_getnext(scan, 0,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.23 1998/07/20 19:53:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.24 1998/07/27 19:38:02 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -547,7 +547,7 @@ func_get_candidates(char *funcname, int nargs)
|
||||
ItemPointer iptr;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(heapRelation, false, iptr, &buffer);
|
||||
tuple = heap_fetch(heapRelation, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (HeapTupleIsValid(tuple))
|
||||
{
|
||||
@ -1024,7 +1024,7 @@ find_inheritors(Oid relid, Oid **supervec)
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(relid));
|
||||
|
||||
inhscan = heap_beginscan(inhrel, 0, false, 1, &skey);
|
||||
inhscan = heap_beginscan(inhrel, 0, SnapshotNow, 1, &skey);
|
||||
|
||||
while (HeapTupleIsValid(inhtup = heap_getnext(inhscan, 0, &buf)))
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.13 1998/06/15 19:28:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.14 1998/07/27 19:38:04 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -108,7 +108,7 @@ binary_oper_get_candidates(char *opname,
|
||||
pg_operator_desc = heap_openr(OperatorRelationName);
|
||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||
0,
|
||||
TRUE,
|
||||
SnapshotSelf, /* ??? */
|
||||
nkeys,
|
||||
opKey);
|
||||
|
||||
@ -655,7 +655,7 @@ printf("unary_oper_get_candidates: start scan for '%s'\n", op);
|
||||
pg_operator_desc = heap_openr(OperatorRelationName);
|
||||
pg_operator_scan = heap_beginscan(pg_operator_desc,
|
||||
0,
|
||||
TRUE,
|
||||
SnapshotSelf, /* ??? */
|
||||
2,
|
||||
opKey);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.14 1998/04/26 04:07:07 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.15 1998/07/27 19:38:08 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -87,7 +87,7 @@ RemoveRewriteRule(char *ruleName)
|
||||
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_rewrite_rulename,
|
||||
F_NAMEEQ, NameGetDatum(ruleName));
|
||||
scanDesc = heap_beginscan(RewriteRelation,
|
||||
0, false, 1, &scanKeyData);
|
||||
0, SnapshotNow, 1, &scanKeyData);
|
||||
|
||||
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
||||
|
||||
@ -161,7 +161,7 @@ RelationRemoveRules(Oid relid)
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(relid));
|
||||
scanDesc = heap_beginscan(RewriteRelation,
|
||||
0, false, 1, &scanKeyData);
|
||||
0, SnapshotNow, 1, &scanKeyData);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.23 1998/07/26 04:30:38 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.24 1998/07/27 19:38:09 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -16,11 +16,7 @@
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/indexing.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_class_mb.h"
|
||||
#else
|
||||
#include "catalog/pg_class.h"
|
||||
#endif
|
||||
#include "catalog/pg_rewrite.h"
|
||||
#include "fmgr.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
@ -109,7 +105,7 @@ IsDefinedRewriteRule(char *ruleName)
|
||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_rewrite_rulename,
|
||||
F_NAMEEQ, PointerGetDatum(ruleName));
|
||||
scanDesc = heap_beginscan(RewriteRelation,
|
||||
0, false, 1, &scanKey);
|
||||
0, SnapshotNow, 1, &scanKey);
|
||||
|
||||
tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.28 1998/07/21 06:17:35 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.29 1998/07/27 19:38:10 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -585,7 +585,6 @@ ShmemInitStruct(char *name, unsigned long size, bool *foundPtr)
|
||||
return (structPtr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* TransactionIdIsInProgress -- is given transaction running by some backend
|
||||
*
|
||||
@ -625,3 +624,75 @@ TransactionIdIsInProgress(TransactionId xid)
|
||||
elog(ERROR, "TransactionIdIsInProgress: ShmemIndex corrupted");
|
||||
return (false);
|
||||
}
|
||||
|
||||
#ifdef LowLevelLocking
|
||||
/*
|
||||
* GetSnapshotData -- returns information about running transactions.
|
||||
*
|
||||
* InvalidTransactionId is used as terminator in snapshot->xip array.
|
||||
* If serialized is true then XID >= current xact ID will not be
|
||||
* placed in array. Current xact ID are never placed there (just
|
||||
* to reduce its length, xmin/xmax may be equal to cid).
|
||||
* MyProc->xmin will be setted if equal to InvalidTransactionId.
|
||||
*
|
||||
* Yet another strange func for this place... - vadim 07/21/98
|
||||
*/
|
||||
Snapshot
|
||||
GetSnapshotData(bool serialized)
|
||||
{
|
||||
Snapshot snapshot = (Snapshot) malloc(sizeof(SnapshotData));
|
||||
TransactionId snapshot->xip = (TransactionId*)
|
||||
malloc(32 * sizeof(TransactionId));
|
||||
ShmemIndexEnt *result;
|
||||
PROC *proc;
|
||||
TransactionId cid = GetCurrentTransactionId();
|
||||
uint count = 0;
|
||||
unit free = 31;
|
||||
|
||||
Assert(ShmemIndex);
|
||||
|
||||
snapshot->xmax = cid;
|
||||
snapshot->xmin = cid;
|
||||
|
||||
SpinAcquire(ShmemIndexLock);
|
||||
|
||||
hash_seq((HTAB *) NULL);
|
||||
while ((result = (ShmemIndexEnt *) hash_seq(ShmemIndex)) != NULL)
|
||||
{
|
||||
if (result == (ShmemIndexEnt *) TRUE)
|
||||
{
|
||||
if (MyProc->xmin == InvalidTransactionId)
|
||||
MyProc->xmin = snapshot->xmin;
|
||||
SpinRelease(ShmemIndexLock);
|
||||
snapshot->xip[count] = InvalidTransactionId;
|
||||
return (snapshot);
|
||||
}
|
||||
if (result->location == INVALID_OFFSET ||
|
||||
strncmp(result->key, "PID ", 4) != 0)
|
||||
continue;
|
||||
proc = (PROC *) MAKE_PTR(result->location);
|
||||
if (proc == MyProc || proc->xid < FirstTransactionId ||
|
||||
serialized && proc->xid >= cid)
|
||||
continue;
|
||||
if (proc->xid < snapshot->xmin)
|
||||
snapshot->xmin = proc->xid;
|
||||
else if (proc->xid > snapshot->xmax)
|
||||
snapshot->xmax = proc->xid;
|
||||
if (free == 0)
|
||||
{
|
||||
snapshot->xip = (TransactionId*) realloc(snapshot->xip,
|
||||
(count + 33) * sizeof(TransactionId));
|
||||
free = 32;
|
||||
}
|
||||
snapshot->xip[count] = proc->xid;
|
||||
free--;
|
||||
count++;
|
||||
}
|
||||
|
||||
SpinRelease(ShmemIndexLock);
|
||||
free(snapshot->xip);
|
||||
free(snapshot);
|
||||
elog(ERROR, "GetSnapshotData: ShmemIndex corrupted");
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.31 1998/07/21 04:17:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.32 1998/07/27 19:38:11 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -656,9 +656,13 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
|
||||
* For time travel, we need to use the actual time qual here,
|
||||
* rather that NowTimeQual. We currently have no way to pass
|
||||
* a time qual in.
|
||||
*
|
||||
* This is now valid for snapshot !!!
|
||||
* And should be fixed in some way... - vadim 07/28/98
|
||||
*
|
||||
*/
|
||||
|
||||
htup = heap_fetch(obj_desc->heap_r, false,
|
||||
htup = heap_fetch(obj_desc->heap_r, SnapshotNow,
|
||||
&(res->heap_iptr), bufP);
|
||||
|
||||
} while (htup == (HeapTuple) NULL);
|
||||
@ -669,7 +673,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
|
||||
}
|
||||
else
|
||||
{
|
||||
htup = heap_fetch(obj_desc->heap_r, false,
|
||||
htup = heap_fetch(obj_desc->heap_r, SnapshotNow,
|
||||
&(obj_desc->htid), bufP);
|
||||
}
|
||||
|
||||
@ -1235,7 +1239,7 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
|
||||
if (buf != InvalidBuffer)
|
||||
ReleaseBuffer(buf);
|
||||
|
||||
htup = heap_fetch(hreln, false, &(res->heap_iptr), &buf);
|
||||
htup = heap_fetch(hreln, SnapshotNow, &(res->heap_iptr), &buf);
|
||||
pfree(res);
|
||||
|
||||
} while (!HeapTupleIsValid(htup));
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.39 1998/06/30 02:33:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.40 1998/07/27 19:38:15 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -46,7 +46,7 @@
|
||||
* This is so that we can support more backends. (system-wide semaphore
|
||||
* sets run out pretty fast.) -ay 4/95
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.39 1998/06/30 02:33:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.40 1998/07/27 19:38:15 vadim Exp $
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
@ -252,6 +252,9 @@ InitProcess(IPCKey key)
|
||||
MyProc->pid = MyProcPid;
|
||||
#endif
|
||||
MyProc->xid = InvalidTransactionId;
|
||||
#ifdef LowLevelLocking
|
||||
MyProc->xmin = InvalidTransactionId;
|
||||
#endif
|
||||
|
||||
/* ----------------
|
||||
* Start keeping spin lock stats from here on. Any botch before
|
||||
@ -479,11 +482,13 @@ ProcSleep(PROC_QUEUE *waitQueue,
|
||||
MyProc->token = token;
|
||||
MyProc->waitLock = lock;
|
||||
|
||||
#ifndef LowLevelLocking
|
||||
/* -------------------
|
||||
* currently, we only need this for the ProcWakeup routines
|
||||
* -------------------
|
||||
*/
|
||||
TransactionIdStore((TransactionId) GetCurrentTransactionId(), &MyProc->xid);
|
||||
#endif
|
||||
|
||||
/* -------------------
|
||||
* assume that these two operations are atomic (because
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.9 1998/06/15 19:29:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.10 1998/07/27 19:38:18 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -72,8 +72,8 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
|
||||
/* the last argument should be a ScanKey, not an integer! - jolly */
|
||||
/* it looks like the arguments are out of order, too */
|
||||
/* but skeyData is never initialized! does this work?? - ay 2/95 */
|
||||
scan_descriptor = heap_beginscan(relation_to_scan, false, false, 0,
|
||||
&skeyData);
|
||||
scan_descriptor = heap_beginscan(relation_to_scan, false, SnapshotNow,
|
||||
0, &skeyData);
|
||||
|
||||
retval = true;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.20 1998/07/20 16:57:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.21 1998/07/27 19:38:19 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -55,7 +55,7 @@ regprocin(char *proname)
|
||||
(RegProcedure) F_NAMEEQ,
|
||||
(Datum) proname);
|
||||
|
||||
procscan = heap_beginscan(proc, 0, false, 1, &key);
|
||||
procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key);
|
||||
if (!HeapScanIsValid(procscan))
|
||||
{
|
||||
heap_close(proc);
|
||||
@ -111,7 +111,7 @@ regprocout(RegProcedure proid)
|
||||
(RegProcedure) F_INT4EQ,
|
||||
(Datum) proid);
|
||||
|
||||
procscan = heap_beginscan(proc, 0, false, 1, &key);
|
||||
procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key);
|
||||
if (!HeapScanIsValid(procscan))
|
||||
{
|
||||
heap_close(proc);
|
||||
@ -189,7 +189,7 @@ oid8types(Oid (*oidArray)[])
|
||||
(RegProcedure) F_INT4EQ,
|
||||
(Datum) *sp);
|
||||
|
||||
typescan = heap_beginscan(type, 0, false, 1, &key);
|
||||
typescan = heap_beginscan(type, 0, SnapshotNow, 1, &key);
|
||||
if (!HeapScanIsValid(typescan))
|
||||
{
|
||||
heap_close(type);
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.20 1998/07/27 19:38:20 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -349,7 +349,7 @@ gethilokey(Oid relid,
|
||||
key[0].sk_argument = ObjectIdGetDatum(relid);
|
||||
key[1].sk_argument = Int16GetDatum((int16) attnum);
|
||||
key[2].sk_argument = ObjectIdGetDatum(opid);
|
||||
sdesc = heap_beginscan(rdesc, 0, false, 3, key);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 3, key);
|
||||
tuple = heap_getnext(sdesc, 0, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.14 1998/07/20 16:57:02 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.15 1998/07/27 19:38:21 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -123,7 +123,7 @@ SetDefine(char *querystr, char *typename)
|
||||
oidKey[0].sk_argument = ObjectIdGetDatum(setoid);
|
||||
pg_proc_scan = heap_beginscan(procrel,
|
||||
0,
|
||||
true,
|
||||
SnapshotSelf,
|
||||
1,
|
||||
oidKey);
|
||||
tup = heap_getnext(pg_proc_scan, 0, &buffer);
|
||||
|
4
src/backend/utils/cache/catcache.c
vendored
4
src/backend/utils/cache/catcache.c
vendored
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.30 1998/07/20 16:57:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.31 1998/07/27 19:38:22 vadim Exp $
|
||||
*
|
||||
* Notes:
|
||||
* XXX This needs to use exception.h to handle recovery when
|
||||
@ -994,7 +994,7 @@ SearchSysCache(struct catcache * cache,
|
||||
*/
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
|
||||
sd = heap_beginscan(relation, 0, false,
|
||||
sd = heap_beginscan(relation, 0, SnapshotNow,
|
||||
cache->cc_nkeys, cache->cc_skey);
|
||||
|
||||
/* should this buffer be ReleaseBuffer'd? --djm 8/20/96 */
|
||||
|
16
src/backend/utils/cache/relcache.c
vendored
16
src/backend/utils/cache/relcache.c
vendored
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.43 1998/07/26 04:30:57 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.44 1998/07/27 19:38:23 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -53,11 +53,7 @@
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/pg_aggregate.h"
|
||||
#include "catalog/pg_attrdef.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_attribute_mb.h"
|
||||
#else
|
||||
#include "catalog/pg_attribute.h"
|
||||
#endif
|
||||
#include "catalog/pg_index.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_class.h"
|
||||
@ -376,7 +372,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
|
||||
if (!IsInitProcessingMode())
|
||||
RelationSetLockForRead(pg_class_desc);
|
||||
pg_class_scan =
|
||||
heap_beginscan(pg_class_desc, 0, false, 1, &key);
|
||||
heap_beginscan(pg_class_desc, 0, SnapshotNow, 1, &key);
|
||||
pg_class_tuple = heap_getnext(pg_class_scan, 0, &buf);
|
||||
|
||||
/* ----------------
|
||||
@ -546,7 +542,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
|
||||
*/
|
||||
pg_attribute_desc = heap_openr(AttributeRelationName);
|
||||
pg_attribute_scan =
|
||||
heap_beginscan(pg_attribute_desc, 0, false, 1, &key);
|
||||
heap_beginscan(pg_attribute_desc, 0, SnapshotNow, 1, &key);
|
||||
|
||||
/* ----------------
|
||||
* add attribute data to relation->rd_att
|
||||
@ -717,7 +713,7 @@ RelationBuildRuleLock(Relation relation)
|
||||
*/
|
||||
pg_rewrite_desc = heap_openr(RewriteRelationName);
|
||||
pg_rewrite_scan =
|
||||
heap_beginscan(pg_rewrite_desc, 0, false, 1, &key);
|
||||
heap_beginscan(pg_rewrite_desc, 0, SnapshotNow, 1, &key);
|
||||
pg_rewrite_tupdesc =
|
||||
RelationGetTupleDescriptor(pg_rewrite_desc);
|
||||
|
||||
@ -1705,7 +1701,7 @@ AttrDefaultFetch(Relation relation)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(adrel, false, iptr, &buffer);
|
||||
tuple = heap_fetch(adrel, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
continue;
|
||||
@ -1793,7 +1789,7 @@ RelCheckFetch(Relation relation)
|
||||
break;
|
||||
|
||||
iptr = &indexRes->heap_iptr;
|
||||
tuple = heap_fetch(rcrel, false, iptr, &buffer);
|
||||
tuple = heap_fetch(rcrel, SnapshotNow, iptr, &buffer);
|
||||
pfree(indexRes);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
continue;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.13 1998/07/26 04:31:07 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.14 1998/07/27 19:38:26 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -22,12 +22,7 @@
|
||||
#include "access/heapam.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catname.h"
|
||||
#ifdef MULTIBYTE
|
||||
#include "catalog/pg_database_mb.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#else
|
||||
#include "catalog/pg_database.h"
|
||||
#endif
|
||||
#include "fmgr.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/bufmgr.h"
|
||||
@ -62,7 +57,7 @@ GetDatabaseInfo(char *name, Oid *owner, char *path)
|
||||
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
|
||||
F_NAMEEQ, NameGetDatum(name));
|
||||
|
||||
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
|
||||
scan = heap_beginscan(dbrel, 0, SnapshotNow, 1, &scanKey);
|
||||
if (!HeapScanIsValid(scan))
|
||||
elog(ERROR, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
|
||||
|
||||
@ -184,11 +179,7 @@ ExpandDatabasePath(char *dbpath)
|
||||
* --------------------------------
|
||||
*/
|
||||
void
|
||||
#ifdef MULTIBYTE
|
||||
GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path, int *encoding)
|
||||
#else
|
||||
GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
|
||||
#endif
|
||||
{
|
||||
int dbfd;
|
||||
int fileflags;
|
||||
@ -275,25 +266,14 @@ GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
|
||||
* means of getting at sys cat attrs.
|
||||
*/
|
||||
tup_db = (Form_pg_database) GETSTRUCT(tup);
|
||||
#ifdef MULTIBYTE
|
||||
/* get encoding from template database.
|
||||
This is the "default for default" for
|
||||
create database command.
|
||||
*/
|
||||
if (strcmp("template1",tup_db->datname.data) == 0)
|
||||
{
|
||||
SetTemplateEncoding(tup_db->encoding);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcmp(name, tup_db->datname.data) == 0)
|
||||
{
|
||||
*db_id = tup->t_oid;
|
||||
strncpy(path, VARDATA(&(tup_db->datpath)),
|
||||
(VARSIZE(&(tup_db->datpath)) - VARHDRSZ));
|
||||
*(path + VARSIZE(&(tup_db->datpath)) - VARHDRSZ) = '\0';
|
||||
#ifdef MULTIBYTE
|
||||
*encoding = tup_db->encoding;
|
||||
#endif
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: heapam.h,v 1.33 1998/06/15 18:39:53 momjian Exp $
|
||||
* $Id: heapam.h,v 1.34 1998/07/27 19:38:29 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -18,6 +18,7 @@
|
||||
#include <access/relscan.h>
|
||||
#include <storage/block.h>
|
||||
#include <utils/rel.h>
|
||||
#include <utils/tqual.h>
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* heap access method statistics
|
||||
@ -247,11 +248,11 @@ extern Relation heap_openr(char *relationName);
|
||||
extern void heap_close(Relation relation);
|
||||
extern HeapScanDesc
|
||||
heap_beginscan(Relation relation, int atend,
|
||||
bool seeself, unsigned nkeys, ScanKey key);
|
||||
Snapshot snapshot, unsigned nkeys, ScanKey key);
|
||||
extern void heap_rescan(HeapScanDesc sdesc, bool scanFromEnd, ScanKey key);
|
||||
extern void heap_endscan(HeapScanDesc sdesc);
|
||||
extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
|
||||
extern HeapTuple heap_fetch(Relation relation, bool seeself, ItemPointer tid, Buffer *b);
|
||||
extern HeapTuple heap_fetch(Relation relation, Snapshot snapshot, ItemPointer tid, Buffer *b);
|
||||
extern Oid heap_insert(Relation relation, HeapTuple tup);
|
||||
extern int heap_delete(Relation relation, ItemPointer tid);
|
||||
extern int
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: relscan.h,v 1.10 1997/11/24 05:09:39 momjian Exp $
|
||||
* $Id: relscan.h,v 1.11 1998/07/27 19:38:29 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -16,6 +16,7 @@
|
||||
#include <storage/buf.h>
|
||||
#include <utils/rel.h>
|
||||
#include <access/htup.h>
|
||||
#include <utils/tqual.h>
|
||||
|
||||
typedef ItemPointerData MarkData;
|
||||
|
||||
@ -32,8 +33,8 @@ typedef struct HeapScanDescData
|
||||
ItemPointerData rs_mctid; /* marked current tid */
|
||||
ItemPointerData rs_mntid; /* marked next tid */
|
||||
ItemPointerData rs_mcd; /* marked current delta XXX ??? */
|
||||
Snapshot rs_snapshot; /* snapshot to see */
|
||||
bool rs_atend; /* restart scan at end? */
|
||||
bool rs_seeself; /* see self or not */
|
||||
uint16 rs_cdelta; /* current delta in chain */
|
||||
uint16 rs_nkeys; /* number of attributes in keys */
|
||||
ScanKey rs_key; /* key descriptors */
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: xact.h,v 1.13 1998/04/24 14:42:55 momjian Exp $
|
||||
* $Id: xact.h,v 1.14 1998/07/27 19:38:30 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -22,14 +22,22 @@
|
||||
*/
|
||||
typedef struct TransactionStateData
|
||||
{
|
||||
TransactionId transactionIdData;
|
||||
CommandId commandId;
|
||||
CommandId scanCommandId;
|
||||
AbsoluteTime startTime;
|
||||
int state;
|
||||
int blockState;
|
||||
TransactionId transactionIdData;
|
||||
CommandId commandId;
|
||||
CommandId scanCommandId;
|
||||
AbsoluteTime startTime;
|
||||
int state;
|
||||
int blockState;
|
||||
} TransactionStateData;
|
||||
|
||||
/*
|
||||
* Xact isolation levels
|
||||
*/
|
||||
#define XACT_DIRTY_READ 0 /* not implemented */
|
||||
#define XACT_READ_COMMITTED 1
|
||||
#define XACT_REPEATABLE_READ 2 /* not implemented */
|
||||
#define XACT_SERIALIZED 3
|
||||
|
||||
/* ----------------
|
||||
* transaction states
|
||||
* ----------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: executor.h,v 1.22 1998/04/24 14:43:07 momjian Exp $
|
||||
* $Id: executor.h,v 1.23 1998/07/27 19:38:32 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -61,8 +61,8 @@
|
||||
*/
|
||||
extern void
|
||||
ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
|
||||
ScanDirection dir, Relation *returnRelation,
|
||||
Pointer *returnScanDesc);
|
||||
ScanDirection dir, Snapshot snapshot,
|
||||
Relation *returnRelation, Pointer *returnScanDesc);
|
||||
extern void ExecCloseR(Plan *node);
|
||||
extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
|
||||
extern HeapScanDesc
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: execnodes.h,v 1.15 1998/02/26 04:41:55 momjian Exp $
|
||||
* $Id: execnodes.h,v 1.16 1998/07/27 19:38:34 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -194,19 +194,20 @@ typedef struct JunkFilter
|
||||
*/
|
||||
typedef struct EState
|
||||
{
|
||||
NodeTag type;
|
||||
ScanDirection es_direction;
|
||||
List *es_range_table;
|
||||
RelationInfo *es_result_relation_info;
|
||||
Relation es_into_relation_descriptor;
|
||||
ParamListInfo es_param_list_info;
|
||||
ParamExecData *es_param_exec_vals; /* this is for subselects */
|
||||
int es_BaseId;
|
||||
TupleTable es_tupleTable;
|
||||
JunkFilter *es_junkFilter;
|
||||
int *es_refcount;
|
||||
uint32 es_processed; /* # of tuples processed */
|
||||
Oid es_lastoid; /* last oid processed (by INSERT) */
|
||||
NodeTag type;
|
||||
ScanDirection es_direction;
|
||||
Snapshot es_snapshot;
|
||||
List *es_range_table;
|
||||
RelationInfo *es_result_relation_info;
|
||||
Relation es_into_relation_descriptor;
|
||||
ParamListInfo es_param_list_info;
|
||||
ParamExecData *es_param_exec_vals; /* this is for subselects */
|
||||
int es_BaseId;
|
||||
TupleTable es_tupleTable;
|
||||
JunkFilter *es_junkFilter;
|
||||
int *es_refcount;
|
||||
uint32 es_processed; /* # of tuples processed */
|
||||
Oid es_lastoid; /* last oid processed (by INSERT) */
|
||||
} EState;
|
||||
|
||||
/* ----------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: proc.h,v 1.12 1998/06/30 02:33:33 momjian Exp $
|
||||
* $Id: proc.h,v 1.13 1998/07/27 19:38:38 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -44,6 +44,14 @@ typedef struct proc
|
||||
TransactionId xid; /* transaction currently being executed by
|
||||
* this proc */
|
||||
|
||||
#ifdef LowLevelLocking
|
||||
TransactionId xmin; /* minimal running XID as it was when
|
||||
* we were starting our xact: vacuum
|
||||
* must not remove tuples deleted by
|
||||
* xid >= xmin !
|
||||
*/
|
||||
#endif
|
||||
|
||||
LOCK *waitLock; /* Lock we're sleeping on */
|
||||
int token; /* info for proc wakeup routines */
|
||||
int pid; /* This procs process id */
|
||||
|
@ -3,10 +3,11 @@
|
||||
* tqual.h--
|
||||
* POSTGRES "time" qualification definitions.
|
||||
*
|
||||
* Should be moved/renamed... - vadim 07/28/98
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: tqual.h,v 1.12 1998/04/24 14:43:33 momjian Exp $
|
||||
* $Id: tqual.h,v 1.13 1998/07/27 19:38:40 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -15,6 +16,20 @@
|
||||
|
||||
#include <access/htup.h>
|
||||
|
||||
typedef struct SnapshotData
|
||||
{
|
||||
TransactionId xmin; /* XID < xmin are visible to me */
|
||||
TransactionId xmax; /* XID > xmax are invisible to me */
|
||||
TransactionId *xip; /* array of xacts in progress */
|
||||
} SnapshotData;
|
||||
|
||||
typedef SnapshotData *Snapshot;
|
||||
|
||||
#define IsSnapshotNow(snapshot) ((Snapshot) snapshot == (Snapshot) 0x0)
|
||||
#define IsSnapshotSelf(snapshot) ((Snapshot) snapshot == (Snapshot) 0x1)
|
||||
#define SnapshotNow ((Snapshot) 0x0)
|
||||
#define SnapshotSelf ((Snapshot) 0x1)
|
||||
|
||||
extern TransactionId HeapSpecialTransactionId;
|
||||
extern CommandId HeapSpecialCommandId;
|
||||
|
||||
@ -25,13 +40,13 @@ extern CommandId HeapSpecialCommandId;
|
||||
* Note:
|
||||
* Assumes heap tuple is valid.
|
||||
*/
|
||||
#define HeapTupleSatisfiesVisibility(tuple, seeself) \
|
||||
#define HeapTupleSatisfiesVisibility(tuple, snapshot) \
|
||||
( \
|
||||
TransactionIdEquals((tuple)->t_xmax, AmiTransactionId) ? \
|
||||
false \
|
||||
: \
|
||||
( \
|
||||
((seeself) == true || heapisoverride()) ? \
|
||||
(IsSnapshotSelf(snapshot) || heapisoverride()) ? \
|
||||
HeapTupleSatisfiesItself(tuple) \
|
||||
: \
|
||||
HeapTupleSatisfiesNow(tuple) \
|
||||
|
Loading…
Reference in New Issue
Block a user