Naming of network_ops vs. inet_ops for SP-GIST

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: greenreaper(at)hotmail(dot)com
Subject: Naming of network_ops vs. inet_ops for SP-GIST
Date: 2023-01-24 17:25:06
Message-ID: 167458110639.2667300.14741268666497110766@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/spgist-builtin-opclasses.html
Description:

I wanted to add an SP-GIST index for an inet field ip_address

In https://www.postgresql.org/docs/14/spgist-builtin-opclasses.html
network_ops is stated as the built-in opclass for (inet, inet)

On this basis, on this version of pgsql:
psql (15.1 (Debian 15.1-1.pgdg110+1), server 14.6 (Debian
14.6-1.pgdg110+1))

I entered the following command:
# create index concurrently ip_address_spgist_ban_by_ip on ban_by_ip using
spgist (ip_address network_ops);
ERROR: operator class "network_ops" does not exist for access method
"spgist"

However, this worked:
# create index concurrently ip_address_spgist_ban_by_ip on ban_by_ip using
spgist (ip_address inet_ops);
CREATE INDEX

This created the index:
"ip_address_spgist_ban_by_ip" spgist (ip_address)
which worked as expected:
# EXPLAIN ANALYZE select * from ban_by_ip where ip_address >>= '1.2.3.4' and
now() < banuntil_datetime;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------
Index Scan using ip_address_spgist_ban_by_ip on ban_by_ip (cost=0.14..2.57
rows=1 width=32) (actual time=0.013..0.013 rows=0 loops=1)
Index Cond: (ip_address >>= '1.2.3.4'::inet)
Filter: (now() < banuntil_datetime)
Planning Time: 0.149 ms
Execution Time: 0.027 ms
(5 rows)

I notice inet_ops, not network_ops, is mentioned in the docs for 13. Perhaps
it was renamed to network_ops in 15 but not 14?

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2023-01-24 19:58:23 Re: https://www.postgresql.org/account/comments/new/15/sql-alterdatabase.html/
Previous Message PG Doc comments form 2023-01-24 17:16:59 https://www.postgresql.org/account/comments/new/15/sql-alterdatabase.html/