Commit 2186b608 authored by Robert Haas's avatar Robert Haas

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
parent 0f33ee0e
......@@ -3783,7 +3783,8 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</>:<replaceable>&lt;salt&gt;<
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry>
For each column in the index key, this contains the OID of the
collation to use for the index.
the collation to use for the index, or zero if the column is not
of a collatable data type.
</entry>
</row>
......@@ -4770,7 +4771,8 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</>:<replaceable>&lt;salt&gt;<
<entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
<entry>
For each column in the partition key, this contains the OID of the
the collation to use for partitioning.
the collation to use for partitioning, or zero if the column is not
of a collatable data type.
</entry>
</row>
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment