Peter Eisentraut <peter_e@gmx.net> writes:
> On mån, 2011-03-07 at 12:52 -0500, Tom Lane wrote:
>> It looks like indcollation is acting as a
>> substitute for including a CollateClause in the index key expression,
>> which doesn't seem like a particularly good tradeoff considering all
>> the overhead you must introduce into the default case.
> Conceptually, this characterization is correct. But assuming you do
> away with the indcollation column and instead create expression indexes
> on (col COLLATE "x"), you'd then have an interesting time matching those
> expressions to expressions in the query when choosing an index.
Hmm ... interesting point, but I think it already doesn't work in all
cases for expression indexes. There is an analogous issue for
binary-compatible datatypes, which we hack around by stripping
RelabelType nodes before doing this type of comparison. Maybe we'll
have to do something similar with CollateClauses. I never much cared
for that hack, though ... wonder if there is a cleaner way.
regards, tom lane