pgsql: Fix assorted inconsistencies in GiST opclass support function de - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix assorted inconsistencies in GiST opclass support function de
Date
Msg-id E1aLZiA-0002SV-8E@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix assorted inconsistencies in GiST opclass support function declarations.

The conventions specified by the GiST SGML documentation were widely
ignored.  For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum.  None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures.  So let's try to instill
some consistency here.

Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types).  Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same.  So I've specified a convention
that that's what to do always.

Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that.  Standardize
on telling the truth, instead.

Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".

Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.

Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.

So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion.  Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e

Modified Files
--------------
contrib/btree_gist/btree_gist--1.1.sql   |  206 +++++++++++++++---------------
contrib/cube/cube--1.1.sql               |   10 +-
contrib/hstore/hstore--1.3.sql           |   10 +-
contrib/intarray/intarray--1.1.sql       |   14 +-
contrib/ltree/ltree--1.0.sql             |   20 +--
contrib/pg_trgm/pg_trgm--1.2.sql         |   14 +-
contrib/seg/seg--1.0.sql                 |    4 +-
contrib/tsearch2/tsearch2--1.0.sql       |    4 +-
doc/src/sgml/gist.sgml                   |   75 ++++++++---
doc/src/sgml/ref/create_opclass.sgml     |    2 +-
src/backend/access/gist/gistget.c        |    4 +-
src/backend/access/gist/gistproc.c       |   44 ++++++-
src/include/catalog/catversion.h         |    2 +-
src/include/catalog/pg_amproc.h          |    2 +-
src/include/catalog/pg_proc.h            |   30 +++--
src/include/utils/geo_decls.h            |    3 +-
src/test/regress/expected/opr_sanity.out |   11 +-
src/test/regress/sql/opr_sanity.sql      |    4 +-
18 files changed, 266 insertions(+), 193 deletions(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: pgsql: Remove Cygwin-specific code from pg_ctl
Next
From: Alvaro Herrera
Date:
Subject: pgsql: Add two HyperLogLog functions