Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops

From: Stepan Neretin <slpmcf(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
Date: 2025-07-28 06:38:54
Message-ID: CA+Yyo5QYwN=9NOE1GYDu+2ZaO3a8g8ejYDGtk4rCGezFpy6Qqw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jul 28, 2025 at 9:23 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> On Mon, Jul 28, 2025 at 5:16 AM PG Bug reporting form
> <noreply(at)postgresql(dot)org> wrote:
> > CREATE EXTENSION btree_gist;
> >
> > CREATE TABLE t AS SELECT '192.168.1.0/25'::inet AS i;
> >
> > SELECT * FROM t WHERE i << '192.168.1.0/24'::cidr;
> > i
> > ----------------
> > 192.168.1.0/25
> >
> > CREATE INDEX ON t USING gist(i);
> >
> > SELECT * FROM t WHERE i << '192.168.1.0/24'::cidr;
> > i
> > ---
> > (0 rows)
>
> It seems that with gist_inet_ops the index's opfamily does not support
> the '<<' operator correctly.
>
> With inet_ops, the query works correctly.
>
> CC'ing Peter to have a look.
>
> Thanks
> Richard
>
>
>
Hi,

I tried to reproduce this issue on PostgreSQL 18beta2 (commit 3151c264) on
Ubuntu 24.04, but I could not observe the incorrect behavior described.

Here’s what I did:

psql (19devel)
Type "help" for help.

postgres=# CREATE EXTENSION btree_gist;

CREATE TABLE t AS SELECT '192.168.1.0/25'::inet AS i;
CREATE EXTENSION
SELECT 1
postgres=# CREATE INDEX ON t USING gist(i);
CREATE INDEX
postgres=# SELECT * FROM t WHERE i << '192.168.1.0/24'::cidr;
i
----------------
192.168.1.0/25
(1 row)

So the query still returns the expected row after the GiST index is created.
If there are any additional settings or steps required to reproduce,
please let me know.

Best regards,
Stepan Neretin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2025-07-28 08:20:45 Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
Previous Message Sajith Prabhakar Shetty 2025-07-28 06:20:13 Re: Postgres: Queries are too slow after upgrading to PG17 from PG15