mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Make OIDs optional, per discussions in pghackers. WITH OIDS is still the
default, but OIDS are removed from many system catalogs that don't need them. Some interesting side effects: TOAST pointers are 20 bytes not 32 now; pg_description has a three-column key instead of one. Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey has some usefulness; pg_dump dumps comments on indexes, rules, and triggers in a valid order. initdb forced.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Copyright (c) 2000, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.42 2001/07/16 22:43:33 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.43 2001/08/10 18:57:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -105,11 +105,26 @@ ReadNewTransactionId(TransactionId *xid)
|
||||
|
||||
static Oid lastSeenOid = InvalidOid;
|
||||
|
||||
void
|
||||
GetNewObjectId(Oid *oid_return)
|
||||
Oid
|
||||
GetNewObjectId(void)
|
||||
{
|
||||
Oid result;
|
||||
|
||||
SpinAcquire(OidGenLockId);
|
||||
|
||||
/*
|
||||
* Check for wraparound of the OID counter. We *must* not return 0
|
||||
* (InvalidOid); and as long as we have to check that, it seems a good
|
||||
* idea to skip over everything below BootstrapObjectIdData too. (This
|
||||
* basically just reduces the odds of OID collision right after a wrap
|
||||
* occurs.) Note we are relying on unsigned comparison here.
|
||||
*/
|
||||
if (ShmemVariableCache->nextOid < ((Oid) BootstrapObjectIdData))
|
||||
{
|
||||
ShmemVariableCache->nextOid = BootstrapObjectIdData;
|
||||
ShmemVariableCache->oidCount = 0;
|
||||
}
|
||||
|
||||
/* If we run out of logged for use oids then we must log more */
|
||||
if (ShmemVariableCache->oidCount == 0)
|
||||
{
|
||||
@@ -117,13 +132,16 @@ GetNewObjectId(Oid *oid_return)
|
||||
ShmemVariableCache->oidCount = VAR_OID_PREFETCH;
|
||||
}
|
||||
|
||||
if (PointerIsValid(oid_return))
|
||||
lastSeenOid = (*oid_return) = ShmemVariableCache->nextOid;
|
||||
result = ShmemVariableCache->nextOid;
|
||||
|
||||
(ShmemVariableCache->nextOid)++;
|
||||
(ShmemVariableCache->oidCount)--;
|
||||
|
||||
SpinRelease(OidGenLockId);
|
||||
|
||||
lastSeenOid = result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -159,8 +177,8 @@ CheckMaxObjectId(Oid assigned_oid)
|
||||
*/
|
||||
|
||||
XLogPutNextOid(assigned_oid + VAR_OID_PREFETCH);
|
||||
ShmemVariableCache->oidCount = VAR_OID_PREFETCH - 1;
|
||||
ShmemVariableCache->nextOid = assigned_oid + 1;
|
||||
ShmemVariableCache->oidCount = VAR_OID_PREFETCH - 1;
|
||||
|
||||
SpinRelease(OidGenLockId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user