pgsql: Fix index matching for operators with mixed collatable/noncollat

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix index matching for operators with mixed collatable/noncollat
Date: 2011-09-29 04:45:04
Message-ID: E1R98Ua-0002OI-CP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix index matching for operators with mixed collatable/noncollatable inputs.

If an indexable operator for a non-collatable indexed datatype has a
collatable right-hand input type, any OpExpr for it will be marked with a
nonzero inputcollid (since having one collatable input is sufficient to
make that happen). However, an index on a non-collatable column certainly
doesn't have any collation. This caused us to fail to match such operators
to their indexes, because indxpath.c required an exact match of index
collation and clause collation. It seems correct to allow a match when the
index is collation-less regardless of the clause's inputcollid: an operator
with both noncollatable and collatable inputs could perhaps depend on the
collation of the collatable input, but it could hardly expect the index for
the noncollatable input to have that same collation.

Per bug #6232 from Pierre Ducroquet. His example is specifically about
"hstore ? text" but the problem seems quite generic.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0c2c2495ad485ce5a94cdd1ace92721933392fe7

Modified Files
--------------
src/backend/optimizer/path/indxpath.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2011-09-29 21:21:37 pgsql: Fix pg_upgrade for EXEC_BACKEND builds (e.g. Windows) by properl
Previous Message Bruce Momjian 2011-09-29 02:54:38 pgsql: In pg_upgrade, because toast table names can be mismatched with