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-00000000QYN-0o5X@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
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/514d9ce3078a7610186d8bdf1f5991925000a0ab
Modified Files
--------------
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 ++++++++
4 files changed, 52 insertions(+)
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-00000000QYN-0o5X@gemulon.postgresql.org>
References: <E1xU94B-00000000QYN-0o5X@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