pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tender Wang <tndrwang@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
Date: Fri, 01 Aug 2025 00:53:23 -0400
Message-ID: <2197759.1754024003@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHewXN=qY4XqMnqbHt0r-pTvS8mZ51mabExF30XQx8C9Kg0n4Q@mail.gmail.com>
References: <19000-2525470d200672ab@postgresql.org>
	<CAMbWs49vGc45oQ98bhx4dFpXOsimUX9TTnXOXG=i6+X6sAqBRw@mail.gmail.com>
	<d570c46d-1e20-4766-93de-c6fcbc18f282@eisentraut.org>
	<2107725.1753985855@sss.pgh.pa.us>
	<CAMbWs48sCRUbz0CmkPSFEH8G1b9y-erq6rqYpA0sPhb_ZmwOpQ@mail.gmail.com>
	<2189027.1754019208@sss.pgh.pa.us>
	<CAHewXN=qY4XqMnqbHt0r-pTvS8mZ51mabExF30XQx8C9Kg0n4Q@mail.gmail.com>

Tender Wang <tndrwang@gmail.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> 于2025年8月1日周五 11:33写道:
>> Richard Guo <guofenglinux@gmail.com> writes:
>>> On Fri, Aug 1, 2025 at 3:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>>> We've known about this for, um, decades: btree_gist's support for
>>>> inet/cidr is fundamentally broken [1][2].

> What I debugged yesterday was, in  gbt_inet_consistent(),
> 	query = convert_network_to_scalar(dquery, INETOID, &failure);

Right --- as I mentioned in one of the linked threads, the thing that
is fundamentally wrong here is relying on convert_network_to_scalar
in the first place.  That has no charter to deliver exact results,
and it doesn't.  In the present example I think the issue is that
it doesn't consider the netmask at all; but there are many other
cases where it's not an exact representation of inet's sort order.
That's not a big problem for its intended purpose for statistical
estimates, but it's completely fatal for index infrastructure.

			regards, tom lane





view thread (12+ messages)  latest in thread

Message-ID: <2197759.1754024003@sss.pgh.pa.us>
Permalink:  ../2197759.1754024003@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2197759.1754024003@sss.pgh.pa.us

 · 

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: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tndrwang@gmail.com, guofenglinux@gmail.com, peter@eisentraut.org, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
  In-Reply-To: <2197759.1754024003@sss.pgh.pa.us>

* 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