1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Clean up partcollation handling for OID 0.

Consistent with what we do for indexes, we shouldn't try to record
dependencies on collation OID 0 or the default collation OID (which
is pinned).  Also, the fact that indcollation and partcollation can
contain zero OIDs when the data type is not collatable should be
documented.

Amit Langote, per a complaint from me.

Discussion: http://postgr.es/m/CA+Tgmoba5mtPgM3NKfG06vv8na5gGbVOj0h4zvivXQwLw8wXXQ@mail.gmail.com
This commit is contained in:
Robert Haas
2017-06-06 11:07:20 -04:00
parent 0f33ee0e3b
commit 2186b608b3
2 changed files with 12 additions and 5 deletions

View File

@ -3160,9 +3160,14 @@ StorePartitionKey(Relation rel,
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
referenced.classId = CollationRelationId;
referenced.objectId = partcollation[i];
referenced.objectSubId = 0;
/* The default collation is pinned, so don't bother recording it */
if (OidIsValid(partcollation[i]) &&
partcollation[i] != DEFAULT_COLLATION_OID)
{
referenced.classId = CollationRelationId;
referenced.objectId = partcollation[i];
referenced.objectSubId = 0;
}
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}