Обсуждение: pgsql: Rethink extraction of collation dependencies.

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

pgsql: Rethink extraction of collation dependencies.

От
Tom Lane
Дата:
Rethink extraction of collation dependencies.

As it stands, find_expr_references_walker() pays attention to leaf-node
collation fields while ignoring the input collations of actual function
and operator nodes.  That seems exactly backwards from a semantic
standpoint, and it leads to reporting dependencies on collations that
really have nothing to do with the expression's behavior.

Hence, rewrite to look at function input collations instead.  This
isn't completely perfect either; it fails to account for the behavior
of record_eq and its siblings.  (The previous coding at least gave an
approximation of that, though I think it could be fooled pretty easily
into considering the columns of irrelevant composite types.)  We may
be able to improve on this later, but for now this should satisfy the
buildfarm members that didn't like ef387bed8.

In passing fix some oversights in GetTypeCollations(), and get
rid of its duplicative de-duplications.  (I'm worried that it's
still potentially O(N^2) or worse, but this makes it a little
better.)

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

Branch
------
master

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

Modified Files
--------------
src/backend/catalog/dependency.c               | 104 ++++++++++++-------------
src/backend/catalog/pg_type.c                  |  29 ++++---
src/test/regress/expected/collate.icu.utf8.out |  23 +-----
src/test/regress/sql/collate.icu.utf8.sql      |   2 +-
4 files changed, 72 insertions(+), 86 deletions(-)