pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: greenreaper@hotmail.com
Subject: Naming of network_ops vs. inet_ops for SP-GIST
Date: Tue, 24 Jan 2023 17:25:06 +0000
Message-ID: <167458110639.2667300.14741268666497110766@wrigleys.postgresql.org> (raw)

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?


view thread (7+ messages)  latest in thread

Message-ID: <167458110639.2667300.14741268666497110766@wrigleys.postgresql.org>
Permalink:  ../167458110639.2667300.14741268666497110766@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/167458110639.2667300.14741268666497110766@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, greenreaper@hotmail.com
  Subject: Re: Naming of network_ops vs. inet_ops for SP-GIST
  In-Reply-To: <167458110639.2667300.14741268666497110766@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox