pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rethink extraction of collation dependencies.
Date: Sat, 17 Apr 2021 02:23:57 +0000
Message-ID: <E1lXacn-00056Y-I0@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1lXacn-00056Y-I0@gemulon.postgresql.org>
Permalink:  ../E1lXacn-00056Y-I0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lXacn-00056Y-I0@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Rethink extraction of collation dependencies.
  In-Reply-To: <E1lXacn-00056Y-I0@gemulon.postgresql.org>
  References: <E1lXacn-00056Y-I0@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox