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: Give a good error message when we can neither hash nor sort a UN
Date: Thu, 19 Nov 2026 20:49:12 +0000
Message-ID: <E1xU94B-00000000QYJ-0c51@gemulon.postgresql.org> (raw)

Give a good error message when we can neither hash nor sort a UNION.

Prior to v17 we said
ERROR:  could not implement UNION
DETAIL:  Some of the datatypes only support hashing, while others only support sorting.
but this check got lost in refactoring, leading to a much less helpful
message.  Put it back (in generate_union_paths).  Also add a couple of
comparable checks in other places that seem like they could be
vulnerable to this problem, and add some test coverage.

Bug: #19916
Reported-by: Robins Tharakan <tharakan@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19916-8097ca71b8aa4085@postgresql.org
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/882881ac1aa66144be11a52d4aff982baf6f30d0

Modified Files
--------------
src/backend/optimizer/path/allpaths.c  | 11 +++++++++++
src/backend/optimizer/plan/planner.c   | 14 ++++++++++++++
src/backend/optimizer/prep/prepunion.c | 13 +++++++++++++
src/test/regress/expected/union.out    | 17 +++++++++++++++++
src/test/regress/sql/union.sql         |  8 ++++++++
5 files changed, 63 insertions(+)



view thread (4+ messages)  latest in thread

Message-ID: <E1xU94B-00000000QYJ-0c51@gemulon.postgresql.org>
Permalink:  ../E1xU94B-00000000QYJ-0c51@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xU94B-00000000QYJ-0c51@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: Give a good error message when we can neither hash nor sort a UN
  In-Reply-To: <E1xU94B-00000000QYJ-0c51@gemulon.postgresql.org>
  References: <E1xU94B-00000000QYJ-0c51@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