public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Andrei Lepikhov <[email protected]>
Cc: [email protected]
Cc: Peter Eisentraut <[email protected]>
Subject: Re: Hashed SAOP on composite type with non-hashable column errors at runtime
Date: Fri, 05 Jun 2026 14:17:21 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
I wrote:
> In the second place, the same hazard exists for range and
> multirange types, which can have non-hashable subtypes.
> AFAICT noplace at all is defending against that.
I meant to attach the test case I'd made to demonstrate
that this is indeed broken. It's a small variant of
your bug-hashed-saop.sql.
regards, tom lane
create type cashrange as range (subtype=money);
CREATE TABLE ctest (a int, b cashrange);
INSERT INTO ctest SELECT g, cashrange(g::money, (g+1)::money)::cashrange FROM generate_series(1, 1000) g;
ANALYZE ctest;
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, BUFFERS OFF, SUMMARY OFF)
SELECT count(*) FROM ctest
WHERE (a,b) = ANY (ARRAY[(1, '(1,2)'::cashrange), (2, '(3,4)'::cashrange)]);
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, BUFFERS OFF, SUMMARY OFF)
SELECT count(*) FROM ctest
WHERE (a,b) = ANY (ARRAY[
(1, '(1,2)'::cashrange), (2, '(2,3)'::cashrange), (3, '(3,4)'::cashrange),
(4, '(4,5)'::cashrange), (5, '(5,6)'::cashrange), (6, '(6,7)'::cashrange),
(7, '(7,8)'::cashrange), (8, '(8,9)'::cashrange), (9, '(9,10)'::cashrange)
]);
Attachments:
[text/plain] bug-with-range.sql (741B, 2-bug-with-range.sql)
download | inline:
create type cashrange as range (subtype=money);
CREATE TABLE ctest (a int, b cashrange);
INSERT INTO ctest SELECT g, cashrange(g::money, (g+1)::money)::cashrange FROM generate_series(1, 1000) g;
ANALYZE ctest;
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, BUFFERS OFF, SUMMARY OFF)
SELECT count(*) FROM ctest
WHERE (a,b) = ANY (ARRAY[(1, '(1,2)'::cashrange), (2, '(3,4)'::cashrange)]);
EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, BUFFERS OFF, SUMMARY OFF)
SELECT count(*) FROM ctest
WHERE (a,b) = ANY (ARRAY[
(1, '(1,2)'::cashrange), (2, '(2,3)'::cashrange), (3, '(3,4)'::cashrange),
(4, '(4,5)'::cashrange), (5, '(5,6)'::cashrange), (6, '(6,7)'::cashrange),
(7, '(7,8)'::cashrange), (8, '(8,9)'::cashrange), (9, '(9,10)'::cashrange)
]);
view thread (5+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Hashed SAOP on composite type with non-hashable column errors at runtime
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox