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.94.2) (envelope-from ) id 1uhXrX-0018Ja-Hn for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Jul 2025 18:18:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uhXqX-002kCQ-Ip for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Jul 2025 18:17:41 +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.94.2) (envelope-from ) id 1uhXqX-002kCG-A5 for pgsql-bugs@lists.postgresql.org; Thu, 31 Jul 2025 18:17:41 +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.96) (envelope-from ) id 1uhXqU-00043i-20 for pgsql-bugs@lists.postgresql.org; Thu, 31 Jul 2025 18:17:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56VIHZ7A2107726; Thu, 31 Jul 2025 14:17:35 -0400 From: Tom Lane To: Peter Eisentraut cc: Richard Guo , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops In-reply-to: References: <19000-2525470d200672ab@postgresql.org> Comments: In-reply-to Peter Eisentraut message dated "Thu, 31 Jul 2025 17:43:18 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2107724.1753985855.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 31 Jul 2025 14:17:35 -0400 Message-ID: <2107725.1753985855@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > On 28.07.25 04:23, Richard Guo wrote: >> It seems that with gist_inet_ops the index's opfamily does not support >> the '<<' operator correctly. >> With inet_ops, the query works correctly. > This can be reproduced even in PG17. > My mind is a bit boggled about what the actual meaning of the > operator= = > should be in this case, but in any case it seems there might be a = > pre-existing discrepancy in the btree_gist module. We've known about this for, um, decades: btree_gist's support for inet/cidr is fundamentally broken [1][2]. It's still there only because nobody's been able to think of a way of removing it without causing pain for anyone who has indexes like that. But maybe we should just accept that it's going to cause pain and remove it. Actually ... I vaguely recall that we have, or once had, a kluge in CREATE INDEX that would silently substitute another opclass name for a user-specified opclass that wasn't there anymore. That would help with dump/restore scenarios, although it'd be pretty disastrous in pg_upgrade. But we could add a preflight check to pg_upgrade that looked for gist_inet_ops indexes and told users to replace them with network_ops indexes. So maybe there is a way forward? regards, tom lane [1] https://www.postgresql.org/message-id/flat/201010112055.o9BKtZf7011251= %40wwwmaster.postgresql.org [2] https://www.postgresql.org/message-id/flat/7891efc1-8378-2cf2-617b-414= 3848ec895%40proxel.se