]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix CheckAttributeType's handling of collations for ranges.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 Jan 2020 22:03:55 +0000 (17:03 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 Jan 2020 22:03:55 +0000 (17:03 -0500)
commit65aa155135a5c7c913bcb042c51d72eaad53582f
tree97d5512764c2bd709713d04310df0d3e3af139bb
parent0c84199f71e0bf2c192f6ec666e041fd7d9099c9
Fix CheckAttributeType's handling of collations for ranges.

Commit fc7695891 changed CheckAttributeType to recurse into ranges,
but made it pass down the wrong collation (always InvalidOid, since
ranges as such have no collation).  This would result in guaranteed
failure when considering a range type whose subtype is collatable.

Embarrassingly, we lack any regression tests that would expose such
a problem (but fortunately, somebody noticed before we shipped this
bug in any release).

Fix it to pass down the range's subtype collation property instead,
and add some regression test cases to exercise collatable-subtype
ranges a bit more.  Back-patch to all supported branches, as the
previous patch was.

Report and patch by Julien Rouhaud, test cases tweaked by me

Discussion: https://postgr.es/m/CAOBaU_aBWqNweiGUFX0guzBKkcfJ8mnnyyGC_KBQmO12Mj5f_A@mail.gmail.com
src/backend/catalog/heap.c
src/backend/utils/cache/lsyscache.c
src/include/utils/lsyscache.h
src/test/regress/expected/rangetypes.out
src/test/regress/expected/sanity_check.out
src/test/regress/sql/rangetypes.sql