mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Use Snapshot in heap access methods.
This commit is contained in:
@@ -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)))
|
||||
{
|
||||
|
Reference in New Issue
Block a user