aboutsummaryrefslogtreecommitdiff
path: root/contrib/intarray
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-01-19 12:04:32 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-01-19 12:04:36 -0500
commit9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e (patch)
tree197b0e0ba7124ba99aa77b0344f418a7b6fbb9cf /contrib/intarray
parent53c949c1be2f43cd47cb433923e76ea00e9222bc (diff)
downloadpostgresql-9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e.tar.gz
postgresql-9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e.zip
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.
Diffstat (limited to 'contrib/intarray')
-rw-r--r--contrib/intarray/intarray--1.1.sql14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/intarray/intarray--1.1.sql b/contrib/intarray/intarray--1.1.sql
index 817625e54a0..3c45eacaee2 100644
--- a/contrib/intarray/intarray--1.1.sql
+++ b/contrib/intarray/intarray--1.1.sql
@@ -358,7 +358,7 @@ CREATE OPERATOR & (
--------------
-- define the GiST support methods
-CREATE FUNCTION g_int_consistent(internal,_int4,int,oid,internal)
+CREATE FUNCTION g_int_consistent(internal,_int4,smallint,oid,internal)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
@@ -405,7 +405,7 @@ DEFAULT FOR TYPE _int4 USING gist AS
OPERATOR 13 @,
OPERATOR 14 ~,
OPERATOR 20 @@ (_int4, query_int),
- FUNCTION 1 g_int_consistent (internal, _int4, int, oid, internal),
+ FUNCTION 1 g_int_consistent (internal, _int4, smallint, oid, internal),
FUNCTION 2 g_int_union (internal, internal),
FUNCTION 3 g_int_compress (internal),
FUNCTION 4 g_int_decompress (internal),
@@ -435,7 +435,7 @@ CREATE TYPE intbig_gkey (
OUTPUT = _intbig_out
);
-CREATE FUNCTION g_intbig_consistent(internal,internal,int,oid,internal)
+CREATE FUNCTION g_intbig_consistent(internal,_int4,smallint,oid,internal)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
@@ -461,11 +461,11 @@ AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION g_intbig_union(internal, internal)
-RETURNS _int4
+RETURNS intbig_gkey
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
-CREATE FUNCTION g_intbig_same(internal, internal, internal)
+CREATE FUNCTION g_intbig_same(intbig_gkey, intbig_gkey, internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
@@ -482,13 +482,13 @@ AS
OPERATOR 13 @,
OPERATOR 14 ~,
OPERATOR 20 @@ (_int4, query_int),
- FUNCTION 1 g_intbig_consistent (internal, internal, int, oid, internal),
+ FUNCTION 1 g_intbig_consistent (internal, _int4, smallint, oid, internal),
FUNCTION 2 g_intbig_union (internal, internal),
FUNCTION 3 g_intbig_compress (internal),
FUNCTION 4 g_intbig_decompress (internal),
FUNCTION 5 g_intbig_penalty (internal, internal, internal),
FUNCTION 6 g_intbig_picksplit (internal, internal),
- FUNCTION 7 g_intbig_same (internal, internal, internal),
+ FUNCTION 7 g_intbig_same (intbig_gkey, intbig_gkey, internal),
STORAGE intbig_gkey;
--GIN