diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/dbcommands.c | 12 | ||||
-rw-r--r-- | src/backend/commands/trigger.c | 7 | ||||
-rw-r--r-- | src/backend/commands/typecmds.c | 5 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 01b53e06933..40e28a0821c 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.169 2005/08/02 19:02:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.170 2005/08/12 01:35:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -80,7 +80,7 @@ createdb(const CreatedbStmt *stmt) TransactionId src_frozenxid; Oid src_deftablespace; volatile Oid dst_deftablespace; - volatile Relation pg_database_rel = NULL; + volatile Relation pg_database_rel; HeapTuple tuple; TupleDesc pg_database_dsc; Datum new_record[Natts_pg_database]; @@ -347,9 +347,13 @@ createdb(const CreatedbStmt *stmt) /* * Preassign OID for pg_database tuple, so that we can compute db - * path. + * path. We have to open pg_database to do this, but we don't want + * to take ExclusiveLock yet, so just do it and close again. */ - dboid = newoid(); + pg_database_rel = heap_open(DatabaseRelationId, AccessShareLock); + dboid = GetNewOid(pg_database_rel); + heap_close(pg_database_rel, AccessShareLock); + pg_database_rel = NULL; /* * Force dirty buffers out to disk, to ensure source database is diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 9df00d8cbea..4ea973ae7fa 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.190 2005/08/01 20:31:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.191 2005/08/12 01:35:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -184,7 +184,9 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) * Generate the trigger's OID now, so that we can use it in the name * if needed. */ - trigoid = newoid(); + tgrel = heap_open(TriggerRelationId, RowExclusiveLock); + + trigoid = GetNewOid(tgrel); /* * If trigger is an RI constraint, use specified trigger name as @@ -252,7 +254,6 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) * NOTE that this is cool only because we have AccessExclusiveLock on the * relation, so the trigger set won't be changing underneath us. */ - tgrel = heap_open(TriggerRelationId, RowExclusiveLock); ScanKeyInit(&key, Anum_pg_trigger_tgrelid, BTEqualStrategyNumber, F_OIDEQ, diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 31e43cd4281..e0c3a311eac 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.78 2005/08/04 01:09:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.79 2005/08/12 01:35:58 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -339,7 +339,6 @@ DefineType(List *names, List *parameters) typoid = TypeCreate(typeName, /* type name */ typeNamespace, /* namespace */ - InvalidOid, /* preassigned type oid (not done here) */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ internalLength, /* internal size */ @@ -372,7 +371,6 @@ DefineType(List *names, List *parameters) TypeCreate(shadow_type, /* type name */ typeNamespace, /* namespace */ - InvalidOid, /* preassigned type oid (not done here) */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ -1, /* internal size */ @@ -724,7 +722,6 @@ DefineDomain(CreateDomainStmt *stmt) domainoid = TypeCreate(domainName, /* type name */ domainNamespace, /* namespace */ - InvalidOid, /* preassigned type oid (none here) */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ internalLength, /* internal size */ |