diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2018-04-12 16:37:22 +0300 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2018-04-12 16:37:22 +0300 |
commit | c266ed31a8a3beed3533e6a78faeca78234cbd43 (patch) | |
tree | 7e84de64e37a2a7f17739fb28fcbcded62f704ff /src/backend/utils/cache/relcache.c | |
parent | 08ea7a2291db21a618d19d612c8060cda68f1892 (diff) | |
download | postgresql-c266ed31a8a3beed3533e6a78faeca78234cbd43.tar.gz postgresql-c266ed31a8a3beed3533e6a78faeca78234cbd43.zip |
Cleanup covering infrastructure
- Explicitly forbids opclass, collation and indoptions (like DESC/ASC etc) for
including columns. Throw an error if user points that.
- Truncated storage arrays for such attributes to store only key atrributes,
added assertion checks.
- Do not check opfamily and collation for including columns in
CompareIndexInfo()
Discussion: https://www.postgresql.org/message-id/5ee72852-3c4e-ee35-e2ed-c1d053d45c08@sigaev.ru
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index fd2a3cc8c3d..4939d1e3484 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -1637,10 +1637,10 @@ RelationInitIndexAccessInfo(Relation relation) } relation->rd_indcollation = (Oid *) - MemoryContextAllocZero(indexcxt, indnatts * sizeof(Oid)); + MemoryContextAllocZero(indexcxt, indnkeyatts * sizeof(Oid)); relation->rd_indoption = (int16 *) - MemoryContextAllocZero(indexcxt, indnatts * sizeof(int16)); + MemoryContextAllocZero(indexcxt, indnkeyatts * sizeof(int16)); /* * indcollation cannot be referenced directly through the C struct, @@ -1653,7 +1653,7 @@ RelationInitIndexAccessInfo(Relation relation) &isnull); Assert(!isnull); indcoll = (oidvector *) DatumGetPointer(indcollDatum); - memcpy(relation->rd_indcollation, indcoll->values, indnatts * sizeof(Oid)); + memcpy(relation->rd_indcollation, indcoll->values, indnkeyatts * sizeof(Oid)); /* * indclass cannot be referenced directly through the C struct, because it @@ -1685,7 +1685,7 @@ RelationInitIndexAccessInfo(Relation relation) &isnull); Assert(!isnull); indoption = (int2vector *) DatumGetPointer(indoptionDatum); - memcpy(relation->rd_indoption, indoption->values, indnatts * sizeof(int16)); + memcpy(relation->rd_indoption, indoption->values, indnkeyatts * sizeof(int16)); /* * expressions, predicate, exclusion caches will be filled later |