pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix CheckAttributeType's handling of collations for ranges.
Date: Fri, 31 Jan 2020 22:04:30 +0000
Message-ID: <E1ixeOs-0001YI-Fk@gemulon.postgresql.org> (raw)

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

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/59047b6d0c93db208a40a77a3672cbe10b7b04da

Modified Files
--------------
src/backend/catalog/heap.c                 |  3 +-
src/backend/utils/cache/lsyscache.c        | 26 +++++++++
src/include/utils/lsyscache.h              |  1 +
src/test/regress/expected/rangetypes.out   | 89 +++++++++++++++++++++++++++++-
src/test/regress/expected/sanity_check.out |  2 +
src/test/regress/sql/rangetypes.sql        | 30 +++++++++-
6 files changed, 148 insertions(+), 3 deletions(-)



view thread (7+ messages)

Message-ID: <E1ixeOs-0001YI-Fk@gemulon.postgresql.org>
Permalink:  ../E1ixeOs-0001YI-Fk@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ixeOs-0001YI-Fk@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix CheckAttributeType's handling of collations for ranges.
  In-Reply-To: <E1ixeOs-0001YI-Fk@gemulon.postgresql.org>
  References: <E1ixeOs-0001YI-Fk@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox