Обсуждение: pgsql: Fix bogus collation-version-recording logic.

Поиск
Список
Период
Сортировка

pgsql: Fix bogus collation-version-recording logic.

От
Tom Lane
Дата:
Fix bogus collation-version-recording logic.

recordMultipleDependencies had the wrong scope for its "version"
variable, allowing a version label to leak from the collation entry it
was meant for to subsequent non-collation entries.  This is relatively
hard to trigger because of the OID-descending order that the inputs
will normally arrive in: subsequent non-collation items will tend to
be pinned.  But it can be exhibited easily with a custom collation.

Also, don't special-case the default collation, but instead ignore
pinned-ness of a collation when we've found a version for it.  This
avoids creating useless pg_depend entries, and removes a not-very-
future-proof assumption that C, POSIX, and DEFAULT are the only
pinned collations.

A small problem is that, because the default collation may or may
not have a version, the regression tests can't assume anything about
whether dependency entries will be made for it.  This seems OK though
since it's now handled just the same as other collations, and we have
test cases for both versioned and unversioned collations.

Fixes oversights in commit 257836a75.  Thanks to Julien Rouhaud
for review.

Discussion: https://postgr.es/m/3564817.1618420687@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ef387bed87f2787b1012e68e9a33607a1074c123

Modified Files
--------------
src/backend/catalog/pg_depend.c            | 16 +++-------------
src/test/regress/expected/create_index.out | 14 +++++---------
src/test/regress/sql/create_index.sql      |  4 ++--
3 files changed, 10 insertions(+), 24 deletions(-)