Add an in-core GiST index opclass for inet/cidr types

Enterprise / PostgreSQL - Tom Lane [sss.pgh.pa.us] - 8 April 2014 14:46 UTC

This operator class can accelerate subnet/supernet tests as well as btree-equivalent ordered comparisons. It also handles a new network operator inet && inet (overlaps, a/k/a "is supernet or subnet of"), which is expected to be useful in exclusion constraints.

Ideally this opclass would be the default for GiST with inet/cidr data, but we can't mark it that way until we figure out how to do a more or less graceful transition from the current situation, in which the really-completely-bogus inet/cidr opclasses in contrib/btree_gist are marked as default. Having the opclass in core and not default is better than not having it at all, though.

While at it, add new documentation sections to allow us to officially document GiST/GIN/SP-GiST opclasses, something there was never a clear place to do before. I filled these in with some simple tables listing the existing opclasses and the operators they support, but there's certainly scope to put more information there.

Emre Hasegeli, reviewed by Andreas Karlsson, further hacking by me

f23a563 Add an in-core GiST index opclass for inet/cidr types.
doc/src/sgml/func.sgml | 14 +-
doc/src/sgml/gin.sgml | 359 ++++++++++++++
doc/src/sgml/gist.sgml | 178 +++++++
doc/src/sgml/indices.sgml | 28 +-
doc/src/sgml/spgist.sgml | 87 ++++
src/backend/utils/adt/Makefile | 3 +-
src/backend/utils/adt/network.c | 117 +++--
src/backend/utils/adt/network_gist.c | 789 ++++++++++++++++++++++++++++++
src/backend/utils/adt/network_selfuncs.c | 32 ++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_amop.h | 15 +
src/include/catalog/pg_amproc.h | 7 +
src/include/catalog/pg_opclass.h | 1 +
src/include/catalog/pg_operator.h | 10 +-
src/include/catalog/pg_opfamily.h | 1 +
src/include/catalog/pg_proc.h | 23 +
src/include/utils/builtins.h | 1 +
src/include/utils/inet.h | 55 +++
src/test/regress/expected/inet.out | 172 ++++++-
src/test/regress/expected/opr_sanity.out | 11 +-
src/test/regress/sql/inet.sql | 23 +-
21 files changed, 1839 insertions(+), 89 deletions(-)

Upstream: git.postgresql.org


  • Share