Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVZ6n-00237W-0y for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jun 2026 18:17:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVZ6m-00DjQ0-0y for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jun 2026 18:17:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVZ6m-00DjPs-09 for pgsql-bugs@lists.postgresql.org; Fri, 05 Jun 2026 18:17:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wVZ6j-00000001T5K-3kzv for pgsql-bugs@lists.postgresql.org; Fri, 05 Jun 2026 18:17:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 655IHLW73735925; Fri, 5 Jun 2026 14:17:21 -0400 From: Tom Lane To: Andrei Lepikhov cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut Subject: Re: Hashed SAOP on composite type with non-hashable column errors at runtime In-reply-to: <3735597.1780683122@sss.pgh.pa.us> References: <3735597.1780683122@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 05 Jun 2026 14:12:02 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <3735895.1780683414.0@sss.pgh.pa.us> Date: Fri, 05 Jun 2026 14:17:21 -0400 Message-ID: <3735924.1780683441@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3735895.1780683414.1@sss.pgh.pa.us> 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 ------- =_aaaaaaaaaa0 Content-Type: text/plain; name="bug-with-range.sql"; charset="us-ascii" Content-ID: <3735895.1780683414.2@sss.pgh.pa.us> Content-Description: bug-with-range.sql Content-Transfer-Encoding: quoted-printable create type cashrange as range (subtype=3Dmoney); CREATE TABLE ctest (a int, b cashrange); INSERT INTO ctest SELECT g, cashrange(g::money, (g+1)::money)::cashrange F= ROM generate_series(1, 1000) g; ANALYZE ctest; EXPLAIN (ANALYZE, COSTS OFF, TIMING OFF, BUFFERS OFF, SUMMARY OFF) SELECT count(*) FROM ctest WHERE (a,b) =3D 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) =3D 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)'::cashrang= e) ]); ------- =_aaaaaaaaaa0--