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: Compare collations before merging UNION operations.
Date: Tue, 19 Nov 2024 23:26:42 +0000
Message-ID: <E1tDXcI-002cpF-CK@gemulon.postgresql.org> (raw)

Compare collations before merging UNION operations.

In the dim past we figured it was okay to ignore collations
when combining UNION set-operation nodes into a single N-way
UNION operation.  I believe that was fine at the time, but
it stopped being fine when we added nondeterministic collations:
the semantics of distinct-ness are affected by those.  v17 made
it even less fine by allowing per-child sorting operations to
be merged via MergeAppend, although I think we accidentally
avoided any live bug from that.

Add a check that collations match before deciding that two
UNION nodes are equivalent.  I also failed to resist the
temptation to comment plan_union_children() a little better.

Back-patch to all supported branches (v13 now), since they
all have nondeterministic collations.

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

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/prep/prepunion.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1tDXcI-002cpF-CK@gemulon.postgresql.org>
Permalink:  ../E1tDXcI-002cpF-CK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tDXcI-002cpF-CK@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Compare collations before merging UNION operations.
  In-Reply-To: <E1tDXcI-002cpF-CK@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