diff options
Diffstat (limited to 'src/backend/catalog/index.c')
-rw-r--r-- | src/backend/catalog/index.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1fd40c42a3a..61f1d3926a9 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -898,7 +898,12 @@ index_create(Relation heapRelation, collationObjectId, classObjectId); - /* Allocate an OID for the index, unless we were told what to use. */ + /* + * Allocate an OID for the index, unless we were told what to use. + * + * The OID will be the relfilenumber as well, so make sure it doesn't + * collide with either pg_class OIDs or existing physical files. + */ if (!OidIsValid(indexRelationId)) { /* Use binary-upgrade override for pg_class.oid and relfilenumber */ @@ -930,8 +935,8 @@ index_create(Relation heapRelation, } else { - indexRelationId = GetNewOidWithIndex(pg_class, ClassOidIndexId, - Anum_pg_class_oid); + indexRelationId = + GetNewRelFileNumber(tableSpaceId, pg_class, relpersistence); } } |