Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops - Mailing list pgsql-bugs

From Tender Wang
Subject Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
Date
Msg-id CAHewXN=qY4XqMnqbHt0r-pTvS8mZ51mabExF30XQx8C9Kg0n4Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
List pgsql-bugs


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].  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.

> I think correctness should take priority over avoiding pain.

Yeah.  I spent a little time investigating this today, and hope
to have a patch to propose tomorrow.

What I debugged yesterday was, in  gbt_inet_consistent(),

query = convert_network_to_scalar(dquery, INETOID, &failure);
(gdb) p query
$2 = 11822170368
then in gbt_num_consistent(), called tinfo->f_lt(query, key->upper, flinfo), which is gbt_inetlt()
and 
(gdb) p *(double *) b
$5 = 11822170368

a is equal to b, gbt_inet_consistent() returned false, no index tuple found.


--
Thanks,
Tender Wang

pgsql-bugs by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Use-after-free in reorderbuffer.c for INSERT ON CONFLICT
Next
From: Michael Paquier
Date:
Subject: Re: Use-after-free in reorderbuffer.c for INSERT ON CONFLICT