1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +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

@@ -796,13 +796,14 @@ index_create(Relation heapRelation,
*/
if (!OidIsValid(indexRelationId))
{
/*
* Use binary-upgrade override for pg_class.oid/relfilenode, if
* supplied.
*/
if (IsBinaryUpgrade &&
OidIsValid(binary_upgrade_next_index_pg_class_oid))
/* Use binary-upgrade override for pg_class.oid/relfilenode? */
if (IsBinaryUpgrade)
{
if (!OidIsValid(binary_upgrade_next_index_pg_class_oid))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("pg_class index OID value not set when in binary upgrade mode")));
indexRelationId = binary_upgrade_next_index_pg_class_oid;
binary_upgrade_next_index_pg_class_oid = InvalidOid;
}