mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +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:
@ -1986,9 +1986,14 @@ AssignTypeArrayOid(void)
|
||||
{
|
||||
Oid type_array_oid;
|
||||
|
||||
/* Use binary-upgrade override for pg_type.typarray, if supplied. */
|
||||
if (IsBinaryUpgrade && OidIsValid(binary_upgrade_next_array_pg_type_oid))
|
||||
/* Use binary-upgrade override for pg_type.typarray? */
|
||||
if (IsBinaryUpgrade)
|
||||
{
|
||||
if (!OidIsValid(binary_upgrade_next_array_pg_type_oid))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("pg_type array OID value not set when in binary upgrade mode")));
|
||||
|
||||
type_array_oid = binary_upgrade_next_array_pg_type_oid;
|
||||
binary_upgrade_next_array_pg_type_oid = InvalidOid;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user