*** pgsql/src/backend/catalog/heap.c 2010/01/28 23:21:11 1.368 --- pgsql/src/backend/catalog/heap.c 2010/02/03 01:14:16 1.369 *************** *** 8,14 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.367 2010/01/22 16:40:18 rhaas Exp $ * * * INTERFACE ROUTINES --- 8,14 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.368 2010/01/28 23:21:11 petere Exp $ * * * INTERFACE ROUTINES *************** *** 70,75 **** --- 70,79 ---- #include "utils/tqual.h" + /* Kluge for upgrade-in-place support */ + Oid binary_upgrade_next_heap_relfilenode = InvalidOid; + Oid binary_upgrade_next_toast_relfilenode = InvalidOid; + static void AddNewRelationTuple(Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, *************** static Node *cookConstraint(ParseState * *** 98,106 **** char *relname); static List *insert_ordered_unique_oid(List *list, Oid datum); - Oid binary_upgrade_next_heap_relfilenode = InvalidOid; - Oid binary_upgrade_next_toast_relfilenode = InvalidOid; - /* ---------------------------------------------------------------- * XXX UGLY HARD CODED BADNESS FOLLOWS XXX --- 102,107 ---- *************** heap_create_with_catalog(const char *rel *** 955,983 **** errmsg("only shared relations can be placed in pg_global tablespace"))); } ! if ((relkind == RELKIND_RELATION || relkind == RELKIND_SEQUENCE || ! relkind == RELKIND_VIEW || relkind == RELKIND_COMPOSITE_TYPE) && ! OidIsValid(binary_upgrade_next_heap_relfilenode)) ! { ! relid = binary_upgrade_next_heap_relfilenode; ! binary_upgrade_next_heap_relfilenode = InvalidOid; ! } ! else if (relkind == RELKIND_TOASTVALUE && ! OidIsValid(binary_upgrade_next_toast_relfilenode)) ! { ! relid = binary_upgrade_next_toast_relfilenode; ! binary_upgrade_next_toast_relfilenode = InvalidOid; ! } ! else if (!OidIsValid(relid)) { ! /* ! * Allocate an OID for the relation, unless we were told what to use. ! * ! * The OID will be the relfilenode as well, so make sure it doesn't ! * collide with either pg_class OIDs or existing physical files. ! */ ! relid = GetNewRelFileNode(reltablespace, shared_relation, ! pg_class_desc); } /* --- 956,986 ---- errmsg("only shared relations can be placed in pg_global tablespace"))); } ! /* ! * Allocate an OID for the relation, unless we were told what to use. ! * ! * The OID will be the relfilenode as well, so make sure it doesn't ! * collide with either pg_class OIDs or existing physical files. ! */ ! if (!OidIsValid(relid)) { ! /* Use binary-upgrade overrides if applicable */ ! if (OidIsValid(binary_upgrade_next_heap_relfilenode) && ! (relkind == RELKIND_RELATION || relkind == RELKIND_SEQUENCE || ! relkind == RELKIND_VIEW || relkind == RELKIND_COMPOSITE_TYPE)) ! { ! relid = binary_upgrade_next_heap_relfilenode; ! binary_upgrade_next_heap_relfilenode = InvalidOid; ! } ! else if (OidIsValid(binary_upgrade_next_toast_relfilenode) && ! relkind == RELKIND_TOASTVALUE) ! { ! relid = binary_upgrade_next_toast_relfilenode; ! binary_upgrade_next_toast_relfilenode = InvalidOid; ! } ! else ! relid = GetNewRelFileNode(reltablespace, shared_relation, ! pg_class_desc); } /*