pgsql: Rethink extraction of collation dependencies. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Rethink extraction of collation dependencies.
Date
Msg-id E1lXacn-00056Y-I0@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Update dummy prosrc values.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Use correct format placeholder for block numbers