Re: Collation versioning

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Douglas Doole <dougdoole(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Collation versioning
Date: 2020-09-24 09:48:55
Message-ID: 20200924094854.abjmpfqixq6xd4o5@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 20, 2020 at 10:24:26AM +0800, Julien Rouhaud wrote:
> On the other hand the *_pattern_ops are entirely hardcoded, and I
> don't think that we'll ever have an extensible way to have this kind
> of magic exception. So maybe having a flag at the am level is
> acceptable?

Hearing no complaint, I kept the flag at the AM level and added hardcoded
exceptions for the *_pattern_ops opclasses to avoid false positive as much as
possible, and no false negative (at least that I'm aware of). I added many
indexes to the regression tests to make sure that all the cases are correctly

Unfortunately, there's still one case that can't be fixed easily. Here's an
example of such case:

CREATE INDEX ON sometable ((collatable_col || collatable_col) text_pattern_ops)

In this case when iterating over the key columns, the current patch notices
that a dependency on the collation should be added but that the version
shouldn't be tracked, as it's text_pattern_ops. But then the expression itself
is processed, and it also see that a dependency on the collation should be
addedd. However, it has no way to know that it should not update the
previously recorded dependency to start tracking the version, as the expression
could really depends on a stable order.

So we end up with a single dependency (which is what we want I think), but
which will report false positive warning in case of collation lib update.

v30 attached.

Attachment Content-Type Size
v30-0001-Add-a-new-amnostablecollorder-flag-in-IndexAmRou.patch text/plain 6.9 KB
v30-0002-Remove-pg_collation.collversion.patch text/plain 27.7 KB
v30-0003-Add-pg_depend.refobjversion.patch text/plain 12.3 KB
v30-0004-Track-collation-versions-for-indexes.patch text/plain 111.5 KB
v30-0005-Add-ALTER-INDEX-.-ALTER-COLLATION-.-REFRESH-VERS.patch text/plain 14.8 KB
v30-0006-Doc-Add-Collation-Versions-section.patch text/plain 2.5 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message legrand legrand 2020-09-24 09:55:06 Re: [PATCH] Add features to pg_stat_statements
Previous Message Bharath Rupireddy 2020-09-24 09:30:16 Re: Parallel copy