1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

pg_upgrade: prevent automatic oid assignment

Prevent automatic oid assignment when in binary upgrade mode.  Also
throw an error when contrib/pg_upgrade_support functions are called when
not in binary upgrade mode.

This prevent automatically-assigned oids from conflicting with later
pre-assigned oids coming from the old cluster.  It also makes sure oids
are preserved in call important cases.
This commit is contained in:
Bruce Momjian
2014-08-25 22:19:05 -04:00
parent 73fe87503f
commit a7ae1dcf49
8 changed files with 69 additions and 20 deletions

View File

@ -379,10 +379,15 @@ CreateRole(CreateRoleStmt *stmt)
/*
* pg_largeobject_metadata contains pg_authid.oid's, so we use the
* binary-upgrade override, if specified.
* binary-upgrade override.
*/
if (IsBinaryUpgrade && OidIsValid(binary_upgrade_next_pg_authid_oid))
if (IsBinaryUpgrade)
{
if (!OidIsValid(binary_upgrade_next_pg_authid_oid))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("pg_authid OID value not set when in binary upgrade mode")));
HeapTupleSetOid(tuple, binary_upgrade_next_pg_authid_oid);
binary_upgrade_next_pg_authid_oid = InvalidOid;
}