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

Stepan Neretin <slpmcf@gmail.com>

From: Stepan Neretin <slpmcf@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-07-28T06:38:54Z
Lists: pgsql-bugs

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. ecpg: Fix memory leaks in ecpg_auto_prepare()

On Mon, Jul 28, 2025 at 9:23 AM Richard Guo <guofenglinux@gmail.com> wrote:

> On Mon, Jul 28, 2025 at 5:16 AM PG Bug reporting form
> <noreply@postgresql.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