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

From Stepan Neretin
Subject Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
Date
Msg-id CA+Yyo5QYwN=9NOE1GYDu+2ZaO3a8g8ejYDGtk4rCGezFpy6Qqw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops
List pgsql-bugs


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

pgsql-bugs by date:

Previous
From: Sajith Prabhakar Shetty
Date:
Subject: Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
Next
From: Richard Guo
Date:
Subject: Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops