From 9ff60273e35cad6e9d3a4adf59d5c2455afe9d9e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 19 Jan 2016 12:04:32 -0500 Subject: [PATCH] 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. --- contrib/btree_gist/btree_gist--1.1.sql | 206 +++++++++++------------ contrib/cube/cube--1.1.sql | 10 +- contrib/hstore/hstore--1.3.sql | 16 +- 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, 269 insertions(+), 196 deletions(-) diff --git a/contrib/btree_gist/btree_gist--1.1.sql b/contrib/btree_gist/btree_gist--1.1.sql index cdec964c055..f0a4682d9b1 100644 --- a/contrib/btree_gist/btree_gist--1.1.sql +++ b/contrib/btree_gist/btree_gist--1.1.sql @@ -244,7 +244,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_oid_distance(internal,oid,int2,oid) +CREATE FUNCTION gbt_oid_distance(internal,oid,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -284,12 +284,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_oid_union(bytea, internal) +CREATE FUNCTION gbt_oid_union(internal, internal) RETURNS gbtreekey8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_oid_same(internal, internal, internal) +CREATE FUNCTION gbt_oid_same(gbtreekey8, gbtreekey8, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -304,12 +304,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_oid_consistent (internal, oid, int2, oid, internal), - FUNCTION 2 gbt_oid_union (bytea, internal), + FUNCTION 2 gbt_oid_union (internal, internal), FUNCTION 3 gbt_oid_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_oid_penalty (internal, internal, internal), FUNCTION 6 gbt_oid_picksplit (internal, internal), - FUNCTION 7 gbt_oid_same (internal, internal, internal), + FUNCTION 7 gbt_oid_same (gbtreekey8, gbtreekey8, internal), STORAGE gbtreekey8; -- Add operators that are new in 9.1. We do it like this, leaving them @@ -318,7 +318,7 @@ AS ALTER OPERATOR FAMILY gist_oid_ops USING gist ADD OPERATOR 6 <> (oid, oid) , OPERATOR 15 <-> (oid, oid) FOR ORDER BY pg_catalog.oid_ops , - FUNCTION 8 (oid, oid) gbt_oid_distance (internal, oid, int2, oid) , + FUNCTION 8 (oid, oid) gbt_oid_distance (internal, oid, int2, oid, internal) , -- Also add support function for index-only-scans, added in 9.5. FUNCTION 9 (oid, oid) gbt_oid_fetch (internal) ; @@ -336,7 +336,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int2_distance(internal,int2,int2,oid) +CREATE FUNCTION gbt_int2_distance(internal,int2,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -361,12 +361,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int2_union(bytea, internal) +CREATE FUNCTION gbt_int2_union(internal, internal) RETURNS gbtreekey4 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int2_same(internal, internal, internal) +CREATE FUNCTION gbt_int2_same(gbtreekey4, gbtreekey4, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -381,18 +381,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_int2_consistent (internal, int2, int2, oid, internal), - FUNCTION 2 gbt_int2_union (bytea, internal), + FUNCTION 2 gbt_int2_union (internal, internal), FUNCTION 3 gbt_int2_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_int2_penalty (internal, internal, internal), FUNCTION 6 gbt_int2_picksplit (internal, internal), - FUNCTION 7 gbt_int2_same (internal, internal, internal), + FUNCTION 7 gbt_int2_same (gbtreekey4, gbtreekey4, internal), STORAGE gbtreekey4; ALTER OPERATOR FAMILY gist_int2_ops USING gist ADD OPERATOR 6 <> (int2, int2) , OPERATOR 15 <-> (int2, int2) FOR ORDER BY pg_catalog.integer_ops , - FUNCTION 8 (int2, int2) gbt_int2_distance (internal, int2, int2, oid) , + FUNCTION 8 (int2, int2) gbt_int2_distance (internal, int2, int2, oid, internal) , FUNCTION 9 (int2, int2) gbt_int2_fetch (internal) ; -- @@ -408,7 +408,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int4_distance(internal,int4,int2,oid) +CREATE FUNCTION gbt_int4_distance(internal,int4,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -433,12 +433,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int4_union(bytea, internal) +CREATE FUNCTION gbt_int4_union(internal, internal) RETURNS gbtreekey8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int4_same(internal, internal, internal) +CREATE FUNCTION gbt_int4_same(gbtreekey8, gbtreekey8, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -453,18 +453,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_int4_consistent (internal, int4, int2, oid, internal), - FUNCTION 2 gbt_int4_union (bytea, internal), + FUNCTION 2 gbt_int4_union (internal, internal), FUNCTION 3 gbt_int4_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_int4_penalty (internal, internal, internal), FUNCTION 6 gbt_int4_picksplit (internal, internal), - FUNCTION 7 gbt_int4_same (internal, internal, internal), + FUNCTION 7 gbt_int4_same (gbtreekey8, gbtreekey8, internal), STORAGE gbtreekey8; ALTER OPERATOR FAMILY gist_int4_ops USING gist ADD OPERATOR 6 <> (int4, int4) , OPERATOR 15 <-> (int4, int4) FOR ORDER BY pg_catalog.integer_ops , - FUNCTION 8 (int4, int4) gbt_int4_distance (internal, int4, int2, oid) , + FUNCTION 8 (int4, int4) gbt_int4_distance (internal, int4, int2, oid, internal) , FUNCTION 9 (int4, int4) gbt_int4_fetch (internal) ; @@ -481,7 +481,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int8_distance(internal,int8,int2,oid) +CREATE FUNCTION gbt_int8_distance(internal,int8,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -506,12 +506,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int8_union(bytea, internal) +CREATE FUNCTION gbt_int8_union(internal, internal) RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_int8_same(internal, internal, internal) +CREATE FUNCTION gbt_int8_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -526,18 +526,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_int8_consistent (internal, int8, int2, oid, internal), - FUNCTION 2 gbt_int8_union (bytea, internal), + FUNCTION 2 gbt_int8_union (internal, internal), FUNCTION 3 gbt_int8_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_int8_penalty (internal, internal, internal), FUNCTION 6 gbt_int8_picksplit (internal, internal), - FUNCTION 7 gbt_int8_same (internal, internal, internal), + FUNCTION 7 gbt_int8_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_int8_ops USING gist ADD OPERATOR 6 <> (int8, int8) , OPERATOR 15 <-> (int8, int8) FOR ORDER BY pg_catalog.integer_ops , - FUNCTION 8 (int8, int8) gbt_int8_distance (internal, int8, int2, oid) , + FUNCTION 8 (int8, int8) gbt_int8_distance (internal, int8, int2, oid, internal) , FUNCTION 9 (int8, int8) gbt_int8_fetch (internal) ; -- @@ -553,7 +553,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_float4_distance(internal,float4,int2,oid) +CREATE FUNCTION gbt_float4_distance(internal,float4,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -578,12 +578,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_float4_union(bytea, internal) +CREATE FUNCTION gbt_float4_union(internal, internal) RETURNS gbtreekey8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_float4_same(internal, internal, internal) +CREATE FUNCTION gbt_float4_same(gbtreekey8, gbtreekey8, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -598,18 +598,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_float4_consistent (internal, float4, int2, oid, internal), - FUNCTION 2 gbt_float4_union (bytea, internal), + FUNCTION 2 gbt_float4_union (internal, internal), FUNCTION 3 gbt_float4_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_float4_penalty (internal, internal, internal), FUNCTION 6 gbt_float4_picksplit (internal, internal), - FUNCTION 7 gbt_float4_same (internal, internal, internal), + FUNCTION 7 gbt_float4_same (gbtreekey8, gbtreekey8, internal), STORAGE gbtreekey8; ALTER OPERATOR FAMILY gist_float4_ops USING gist ADD OPERATOR 6 <> (float4, float4) , OPERATOR 15 <-> (float4, float4) FOR ORDER BY pg_catalog.float_ops , - FUNCTION 8 (float4, float4) gbt_float4_distance (internal, float4, int2, oid) , + FUNCTION 8 (float4, float4) gbt_float4_distance (internal, float4, int2, oid, internal) , FUNCTION 9 (float4, float4) gbt_float4_fetch (internal) ; -- @@ -625,7 +625,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_float8_distance(internal,float8,int2,oid) +CREATE FUNCTION gbt_float8_distance(internal,float8,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -650,12 +650,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_float8_union(bytea, internal) +CREATE FUNCTION gbt_float8_union(internal, internal) RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_float8_same(internal, internal, internal) +CREATE FUNCTION gbt_float8_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -670,18 +670,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_float8_consistent (internal, float8, int2, oid, internal), - FUNCTION 2 gbt_float8_union (bytea, internal), + FUNCTION 2 gbt_float8_union (internal, internal), FUNCTION 3 gbt_float8_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_float8_penalty (internal, internal, internal), FUNCTION 6 gbt_float8_picksplit (internal, internal), - FUNCTION 7 gbt_float8_same (internal, internal, internal), + FUNCTION 7 gbt_float8_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_float8_ops USING gist ADD OPERATOR 6 <> (float8, float8) , OPERATOR 15 <-> (float8, float8) FOR ORDER BY pg_catalog.float_ops , - FUNCTION 8 (float8, float8) gbt_float8_distance (internal, float8, int2, oid) , + FUNCTION 8 (float8, float8) gbt_float8_distance (internal, float8, int2, oid, internal) , FUNCTION 9 (float8, float8) gbt_float8_fetch (internal) ; -- @@ -697,7 +697,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_ts_distance(internal,timestamp,int2,oid) +CREATE FUNCTION gbt_ts_distance(internal,timestamp,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -707,7 +707,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_tstz_distance(internal,timestamptz,int2,oid) +CREATE FUNCTION gbt_tstz_distance(internal,timestamptz,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -737,12 +737,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_ts_union(bytea, internal) +CREATE FUNCTION gbt_ts_union(internal, internal) RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_ts_same(internal, internal, internal) +CREATE FUNCTION gbt_ts_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -757,18 +757,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_ts_consistent (internal, timestamp, int2, oid, internal), - FUNCTION 2 gbt_ts_union (bytea, internal), + FUNCTION 2 gbt_ts_union (internal, internal), FUNCTION 3 gbt_ts_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_ts_penalty (internal, internal, internal), FUNCTION 6 gbt_ts_picksplit (internal, internal), - FUNCTION 7 gbt_ts_same (internal, internal, internal), + FUNCTION 7 gbt_ts_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_timestamp_ops USING gist ADD OPERATOR 6 <> (timestamp, timestamp) , OPERATOR 15 <-> (timestamp, timestamp) FOR ORDER BY pg_catalog.interval_ops , - FUNCTION 8 (timestamp, timestamp) gbt_ts_distance (internal, timestamp, int2, oid) , + FUNCTION 8 (timestamp, timestamp) gbt_ts_distance (internal, timestamp, int2, oid, internal) , FUNCTION 9 (timestamp, timestamp) gbt_ts_fetch (internal) ; -- Create the operator class @@ -781,18 +781,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_tstz_consistent (internal, timestamptz, int2, oid, internal), - FUNCTION 2 gbt_ts_union (bytea, internal), + FUNCTION 2 gbt_ts_union (internal, internal), FUNCTION 3 gbt_tstz_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_ts_penalty (internal, internal, internal), FUNCTION 6 gbt_ts_picksplit (internal, internal), - FUNCTION 7 gbt_ts_same (internal, internal, internal), + FUNCTION 7 gbt_ts_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_timestamptz_ops USING gist ADD OPERATOR 6 <> (timestamptz, timestamptz) , OPERATOR 15 <-> (timestamptz, timestamptz) FOR ORDER BY pg_catalog.interval_ops , - FUNCTION 8 (timestamptz, timestamptz) gbt_tstz_distance (internal, timestamptz, int2, oid) , + FUNCTION 8 (timestamptz, timestamptz) gbt_tstz_distance (internal, timestamptz, int2, oid, internal) , FUNCTION 9 (timestamptz, timestamptz) gbt_ts_fetch (internal) ; -- @@ -808,7 +808,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_time_distance(internal,time,int2,oid) +CREATE FUNCTION gbt_time_distance(internal,time,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -843,12 +843,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_time_union(bytea, internal) +CREATE FUNCTION gbt_time_union(internal, internal) RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_time_same(internal, internal, internal) +CREATE FUNCTION gbt_time_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -863,18 +863,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_time_consistent (internal, time, int2, oid, internal), - FUNCTION 2 gbt_time_union (bytea, internal), + FUNCTION 2 gbt_time_union (internal, internal), FUNCTION 3 gbt_time_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_time_penalty (internal, internal, internal), FUNCTION 6 gbt_time_picksplit (internal, internal), - FUNCTION 7 gbt_time_same (internal, internal, internal), + FUNCTION 7 gbt_time_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_time_ops USING gist ADD OPERATOR 6 <> (time, time) , OPERATOR 15 <-> (time, time) FOR ORDER BY pg_catalog.interval_ops , - FUNCTION 8 (time, time) gbt_time_distance (internal, time, int2, oid) , + FUNCTION 8 (time, time) gbt_time_distance (internal, time, int2, oid, internal) , FUNCTION 9 (time, time) gbt_time_fetch (internal) ; @@ -887,12 +887,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_timetz_consistent (internal, timetz, int2, oid, internal), - FUNCTION 2 gbt_time_union (bytea, internal), + FUNCTION 2 gbt_time_union (internal, internal), FUNCTION 3 gbt_timetz_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_time_penalty (internal, internal, internal), FUNCTION 6 gbt_time_picksplit (internal, internal), - FUNCTION 7 gbt_time_same (internal, internal, internal), + FUNCTION 7 gbt_time_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_timetz_ops USING gist ADD @@ -913,7 +913,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_date_distance(internal,date,int2,oid) +CREATE FUNCTION gbt_date_distance(internal,date,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -938,12 +938,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_date_union(bytea, internal) +CREATE FUNCTION gbt_date_union(internal, internal) RETURNS gbtreekey8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_date_same(internal, internal, internal) +CREATE FUNCTION gbt_date_same(gbtreekey8, gbtreekey8, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -958,18 +958,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_date_consistent (internal, date, int2, oid, internal), - FUNCTION 2 gbt_date_union (bytea, internal), + FUNCTION 2 gbt_date_union (internal, internal), FUNCTION 3 gbt_date_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_date_penalty (internal, internal, internal), FUNCTION 6 gbt_date_picksplit (internal, internal), - FUNCTION 7 gbt_date_same (internal, internal, internal), + FUNCTION 7 gbt_date_same (gbtreekey8, gbtreekey8, internal), STORAGE gbtreekey8; ALTER OPERATOR FAMILY gist_date_ops USING gist ADD OPERATOR 6 <> (date, date) , OPERATOR 15 <-> (date, date) FOR ORDER BY pg_catalog.integer_ops , - FUNCTION 8 (date, date) gbt_date_distance (internal, date, int2, oid) , + FUNCTION 8 (date, date) gbt_date_distance (internal, date, int2, oid, internal) , FUNCTION 9 (date, date) gbt_date_fetch (internal) ; @@ -986,7 +986,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_intv_distance(internal,interval,int2,oid) +CREATE FUNCTION gbt_intv_distance(internal,interval,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1016,12 +1016,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_intv_union(bytea, internal) +CREATE FUNCTION gbt_intv_union(internal, internal) RETURNS gbtreekey32 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_intv_same(internal, internal, internal) +CREATE FUNCTION gbt_intv_same(gbtreekey32, gbtreekey32, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1036,18 +1036,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_intv_consistent (internal, interval, int2, oid, internal), - FUNCTION 2 gbt_intv_union (bytea, internal), + FUNCTION 2 gbt_intv_union (internal, internal), FUNCTION 3 gbt_intv_compress (internal), FUNCTION 4 gbt_intv_decompress (internal), FUNCTION 5 gbt_intv_penalty (internal, internal, internal), FUNCTION 6 gbt_intv_picksplit (internal, internal), - FUNCTION 7 gbt_intv_same (internal, internal, internal), + FUNCTION 7 gbt_intv_same (gbtreekey32, gbtreekey32, internal), STORAGE gbtreekey32; ALTER OPERATOR FAMILY gist_interval_ops USING gist ADD OPERATOR 6 <> (interval, interval) , OPERATOR 15 <-> (interval, interval) FOR ORDER BY pg_catalog.interval_ops , - FUNCTION 8 (interval, interval) gbt_intv_distance (internal, interval, int2, oid) , + FUNCTION 8 (interval, interval) gbt_intv_distance (internal, interval, int2, oid, internal) , FUNCTION 9 (interval, interval) gbt_intv_fetch (internal) ; @@ -1064,7 +1064,7 @@ RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_cash_distance(internal,money,int2,oid) +CREATE FUNCTION gbt_cash_distance(internal,money,int2,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1089,12 +1089,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_cash_union(bytea, internal) -RETURNS gbtreekey8 +CREATE FUNCTION gbt_cash_union(internal, internal) +RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_cash_same(internal, internal, internal) +CREATE FUNCTION gbt_cash_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1109,18 +1109,18 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_cash_consistent (internal, money, int2, oid, internal), - FUNCTION 2 gbt_cash_union (bytea, internal), + FUNCTION 2 gbt_cash_union (internal, internal), FUNCTION 3 gbt_cash_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_cash_penalty (internal, internal, internal), FUNCTION 6 gbt_cash_picksplit (internal, internal), - FUNCTION 7 gbt_cash_same (internal, internal, internal), + FUNCTION 7 gbt_cash_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_cash_ops USING gist ADD OPERATOR 6 <> (money, money) , OPERATOR 15 <-> (money, money) FOR ORDER BY pg_catalog.money_ops , - FUNCTION 8 (money, money) gbt_cash_distance (internal, money, int2, oid) , + FUNCTION 8 (money, money) gbt_cash_distance (internal, money, int2, oid, internal) , FUNCTION 9 (money, money) gbt_cash_fetch (internal) ; @@ -1157,12 +1157,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_macad_union(bytea, internal) +CREATE FUNCTION gbt_macad_union(internal, internal) RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_macad_same(internal, internal, internal) +CREATE FUNCTION gbt_macad_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1177,12 +1177,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_macad_consistent (internal, macaddr, int2, oid, internal), - FUNCTION 2 gbt_macad_union (bytea, internal), + FUNCTION 2 gbt_macad_union (internal, internal), FUNCTION 3 gbt_macad_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_macad_penalty (internal, internal, internal), FUNCTION 6 gbt_macad_picksplit (internal, internal), - FUNCTION 7 gbt_macad_same (internal, internal, internal), + FUNCTION 7 gbt_macad_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_macaddr_ops USING gist ADD @@ -1228,12 +1228,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_text_union(bytea, internal) +CREATE FUNCTION gbt_text_union(internal, internal) RETURNS gbtreekey_var AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_text_same(internal, internal, internal) +CREATE FUNCTION gbt_text_same(gbtreekey_var, gbtreekey_var, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1248,12 +1248,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_text_consistent (internal, text, int2, oid, internal), - FUNCTION 2 gbt_text_union (bytea, internal), + FUNCTION 2 gbt_text_union (internal, internal), FUNCTION 3 gbt_text_compress (internal), FUNCTION 4 gbt_var_decompress (internal), FUNCTION 5 gbt_text_penalty (internal, internal, internal), FUNCTION 6 gbt_text_picksplit (internal, internal), - FUNCTION 7 gbt_text_same (internal, internal, internal), + FUNCTION 7 gbt_text_same (gbtreekey_var, gbtreekey_var, internal), STORAGE gbtreekey_var; ALTER OPERATOR FAMILY gist_text_ops USING gist ADD @@ -1271,12 +1271,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_bpchar_consistent (internal, bpchar , int2, oid, internal), - FUNCTION 2 gbt_text_union (bytea, internal), + FUNCTION 2 gbt_text_union (internal, internal), FUNCTION 3 gbt_bpchar_compress (internal), FUNCTION 4 gbt_var_decompress (internal), FUNCTION 5 gbt_text_penalty (internal, internal, internal), FUNCTION 6 gbt_text_picksplit (internal, internal), - FUNCTION 7 gbt_text_same (internal, internal, internal), + FUNCTION 7 gbt_text_same (gbtreekey_var, gbtreekey_var, internal), STORAGE gbtreekey_var; ALTER OPERATOR FAMILY gist_bpchar_ops USING gist ADD @@ -1310,12 +1310,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_bytea_union(bytea, internal) +CREATE FUNCTION gbt_bytea_union(internal, internal) RETURNS gbtreekey_var AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_bytea_same(internal, internal, internal) +CREATE FUNCTION gbt_bytea_same(gbtreekey_var, gbtreekey_var, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1330,12 +1330,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_bytea_consistent (internal, bytea, int2, oid, internal), - FUNCTION 2 gbt_bytea_union (bytea, internal), + FUNCTION 2 gbt_bytea_union (internal, internal), FUNCTION 3 gbt_bytea_compress (internal), FUNCTION 4 gbt_var_decompress (internal), FUNCTION 5 gbt_bytea_penalty (internal, internal, internal), FUNCTION 6 gbt_bytea_picksplit (internal, internal), - FUNCTION 7 gbt_bytea_same (internal, internal, internal), + FUNCTION 7 gbt_bytea_same (gbtreekey_var, gbtreekey_var, internal), STORAGE gbtreekey_var; ALTER OPERATOR FAMILY gist_bytea_ops USING gist ADD @@ -1371,12 +1371,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_numeric_union(bytea, internal) +CREATE FUNCTION gbt_numeric_union(internal, internal) RETURNS gbtreekey_var AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_numeric_same(internal, internal, internal) +CREATE FUNCTION gbt_numeric_same(gbtreekey_var, gbtreekey_var, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1391,12 +1391,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_numeric_consistent (internal, numeric, int2, oid, internal), - FUNCTION 2 gbt_numeric_union (bytea, internal), + FUNCTION 2 gbt_numeric_union (internal, internal), FUNCTION 3 gbt_numeric_compress (internal), FUNCTION 4 gbt_var_decompress (internal), FUNCTION 5 gbt_numeric_penalty (internal, internal, internal), FUNCTION 6 gbt_numeric_picksplit (internal, internal), - FUNCTION 7 gbt_numeric_same (internal, internal, internal), + FUNCTION 7 gbt_numeric_same (gbtreekey_var, gbtreekey_var, internal), STORAGE gbtreekey_var; ALTER OPERATOR FAMILY gist_numeric_ops USING gist ADD @@ -1431,12 +1431,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_bit_union(bytea, internal) +CREATE FUNCTION gbt_bit_union(internal, internal) RETURNS gbtreekey_var AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_bit_same(internal, internal, internal) +CREATE FUNCTION gbt_bit_same(gbtreekey_var, gbtreekey_var, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1451,12 +1451,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_bit_consistent (internal, bit, int2, oid, internal), - FUNCTION 2 gbt_bit_union (bytea, internal), + FUNCTION 2 gbt_bit_union (internal, internal), FUNCTION 3 gbt_bit_compress (internal), FUNCTION 4 gbt_var_decompress (internal), FUNCTION 5 gbt_bit_penalty (internal, internal, internal), FUNCTION 6 gbt_bit_picksplit (internal, internal), - FUNCTION 7 gbt_bit_same (internal, internal, internal), + FUNCTION 7 gbt_bit_same (gbtreekey_var, gbtreekey_var, internal), STORAGE gbtreekey_var; ALTER OPERATOR FAMILY gist_bit_ops USING gist ADD @@ -1474,12 +1474,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_bit_consistent (internal, bit, int2, oid, internal), - FUNCTION 2 gbt_bit_union (bytea, internal), + FUNCTION 2 gbt_bit_union (internal, internal), FUNCTION 3 gbt_bit_compress (internal), FUNCTION 4 gbt_var_decompress (internal), FUNCTION 5 gbt_bit_penalty (internal, internal, internal), FUNCTION 6 gbt_bit_picksplit (internal, internal), - FUNCTION 7 gbt_bit_same (internal, internal, internal), + FUNCTION 7 gbt_bit_same (gbtreekey_var, gbtreekey_var, internal), STORAGE gbtreekey_var; ALTER OPERATOR FAMILY gist_vbit_ops USING gist ADD @@ -1515,12 +1515,12 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_inet_union(bytea, internal) +CREATE FUNCTION gbt_inet_union(internal, internal) RETURNS gbtreekey16 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gbt_inet_same(internal, internal, internal) +CREATE FUNCTION gbt_inet_same(gbtreekey16, gbtreekey16, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -1535,12 +1535,12 @@ AS OPERATOR 4 >= , OPERATOR 5 > , FUNCTION 1 gbt_inet_consistent (internal, inet, int2, oid, internal), - FUNCTION 2 gbt_inet_union (bytea, internal), + FUNCTION 2 gbt_inet_union (internal, internal), FUNCTION 3 gbt_inet_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_inet_penalty (internal, internal, internal), FUNCTION 6 gbt_inet_picksplit (internal, internal), - FUNCTION 7 gbt_inet_same (internal, internal, internal), + FUNCTION 7 gbt_inet_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_inet_ops USING gist ADD @@ -1557,12 +1557,12 @@ AS OPERATOR 4 >= (inet, inet) , OPERATOR 5 > (inet, inet) , FUNCTION 1 gbt_inet_consistent (internal, inet, int2, oid, internal), - FUNCTION 2 gbt_inet_union (bytea, internal), + FUNCTION 2 gbt_inet_union (internal, internal), FUNCTION 3 gbt_inet_compress (internal), FUNCTION 4 gbt_decompress (internal), FUNCTION 5 gbt_inet_penalty (internal, internal, internal), FUNCTION 6 gbt_inet_picksplit (internal, internal), - FUNCTION 7 gbt_inet_same (internal, internal, internal), + FUNCTION 7 gbt_inet_same (gbtreekey16, gbtreekey16, internal), STORAGE gbtreekey16; ALTER OPERATOR FAMILY gist_cidr_ops USING gist ADD diff --git a/contrib/cube/cube--1.1.sql b/contrib/cube/cube--1.1.sql index 73f5ced2382..92d4c0ebae4 100644 --- a/contrib/cube/cube--1.1.sql +++ b/contrib/cube/cube--1.1.sql @@ -304,7 +304,7 @@ CREATE OPERATOR ~ ( -- define the GiST support methods -CREATE FUNCTION g_cube_consistent(internal,cube,int,oid,internal) +CREATE FUNCTION g_cube_consistent(internal,cube,smallint,oid,internal) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -339,8 +339,8 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION g_cube_distance (internal, cube, smallint, oid) -RETURNS internal +CREATE FUNCTION g_cube_distance (internal, cube, smallint, oid, internal) +RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -368,11 +368,11 @@ CREATE OPERATOR CLASS gist_cube_ops OPERATOR 17 <-> (cube, cube) FOR ORDER BY float_ops, OPERATOR 18 <=> (cube, cube) FOR ORDER BY float_ops, - FUNCTION 1 g_cube_consistent (internal, cube, int, oid, internal), + FUNCTION 1 g_cube_consistent (internal, cube, smallint, oid, internal), FUNCTION 2 g_cube_union (internal, internal), FUNCTION 3 g_cube_compress (internal), FUNCTION 4 g_cube_decompress (internal), FUNCTION 5 g_cube_penalty (internal, internal, internal), FUNCTION 6 g_cube_picksplit (internal, internal), FUNCTION 7 g_cube_same (cube, cube, internal), - FUNCTION 8 g_cube_distance (internal, cube, smallint, oid); + FUNCTION 8 g_cube_distance (internal, cube, smallint, oid, internal); diff --git a/contrib/hstore/hstore--1.3.sql b/contrib/hstore/hstore--1.3.sql index 995ade1b3ce..07d6082c9e3 100644 --- a/contrib/hstore/hstore--1.3.sql +++ b/contrib/hstore/hstore--1.3.sql @@ -486,16 +486,16 @@ AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION ghstore_union(internal, internal) +RETURNS ghstore +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT; + +CREATE FUNCTION ghstore_same(ghstore, ghstore, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION ghstore_same(internal, internal, internal) -RETURNS internal -AS 'MODULE_PATHNAME' -LANGUAGE C IMMUTABLE STRICT; - -CREATE FUNCTION ghstore_consistent(internal,internal,int,oid,internal) +CREATE FUNCTION ghstore_consistent(internal,hstore,smallint,oid,internal) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -510,13 +510,13 @@ AS --OPERATOR 8 <@ , OPERATOR 13 @ , --OPERATOR 14 ~ , - FUNCTION 1 ghstore_consistent (internal, internal, int, oid, internal), + FUNCTION 1 ghstore_consistent (internal, hstore, smallint, oid, internal), FUNCTION 2 ghstore_union (internal, internal), FUNCTION 3 ghstore_compress (internal), FUNCTION 4 ghstore_decompress (internal), FUNCTION 5 ghstore_penalty (internal, internal, internal), FUNCTION 6 ghstore_picksplit (internal, internal), - FUNCTION 7 ghstore_same (internal, internal, internal), + FUNCTION 7 ghstore_same (ghstore, ghstore, internal), STORAGE ghstore; -- GIN support 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 diff --git a/contrib/ltree/ltree--1.0.sql b/contrib/ltree/ltree--1.0.sql index 7d55fc603f6..94ce5d4eb03 100644 --- a/contrib/ltree/ltree--1.0.sql +++ b/contrib/ltree/ltree--1.0.sql @@ -496,7 +496,7 @@ CREATE TYPE ltree_gist ( ); -CREATE FUNCTION ltree_consistent(internal,internal,int2,oid,internal) +CREATE FUNCTION ltree_consistent(internal,ltree,int2,oid,internal) RETURNS bool as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION ltree_compress(internal) @@ -512,9 +512,9 @@ CREATE FUNCTION ltree_picksplit(internal, internal) RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION ltree_union(internal, internal) -RETURNS int4 as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; +RETURNS ltree_gist as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION ltree_same(internal, internal, internal) +CREATE FUNCTION ltree_same(ltree_gist, ltree_gist, internal) RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE OPERATOR CLASS gist_ltree_ops @@ -532,13 +532,13 @@ CREATE OPERATOR CLASS gist_ltree_ops OPERATOR 15 @ (ltxtquery, ltree) , OPERATOR 16 ? (ltree, _lquery) , OPERATOR 17 ? (_lquery, ltree) , - FUNCTION 1 ltree_consistent (internal, internal, int2, oid, internal), + FUNCTION 1 ltree_consistent (internal, ltree, int2, oid, internal), FUNCTION 2 ltree_union (internal, internal), FUNCTION 3 ltree_compress (internal), FUNCTION 4 ltree_decompress (internal), FUNCTION 5 ltree_penalty (internal, internal, internal), FUNCTION 6 ltree_picksplit (internal, internal), - FUNCTION 7 ltree_same (internal, internal, internal), + FUNCTION 7 ltree_same (ltree_gist, ltree_gist, internal), STORAGE ltree_gist; @@ -822,7 +822,7 @@ CREATE OPERATOR ?@ ( ); --GiST support for ltree[] -CREATE FUNCTION _ltree_consistent(internal,internal,int2,oid,internal) +CREATE FUNCTION _ltree_consistent(internal,_ltree,int2,oid,internal) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -843,11 +843,11 @@ AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; CREATE FUNCTION _ltree_union(internal, internal) -RETURNS int4 +RETURNS ltree_gist AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION _ltree_same(internal, internal, internal) +CREATE FUNCTION _ltree_same(ltree_gist, ltree_gist, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -862,11 +862,11 @@ CREATE OPERATOR CLASS gist__ltree_ops OPERATOR 15 @ (ltxtquery, _ltree), OPERATOR 16 ? (_ltree, _lquery), OPERATOR 17 ? (_lquery, _ltree), - FUNCTION 1 _ltree_consistent (internal, internal, int2, oid, internal), + FUNCTION 1 _ltree_consistent (internal, _ltree, int2, oid, internal), FUNCTION 2 _ltree_union (internal, internal), FUNCTION 3 _ltree_compress (internal), FUNCTION 4 ltree_decompress (internal), FUNCTION 5 _ltree_penalty (internal, internal, internal), FUNCTION 6 _ltree_picksplit (internal, internal), - FUNCTION 7 _ltree_same (internal, internal, internal), + FUNCTION 7 _ltree_same (ltree_gist, ltree_gist, internal), STORAGE ltree_gist; diff --git a/contrib/pg_trgm/pg_trgm--1.2.sql b/contrib/pg_trgm/pg_trgm--1.2.sql index 03d46d07f98..49d7395d477 100644 --- a/contrib/pg_trgm/pg_trgm--1.2.sql +++ b/contrib/pg_trgm/pg_trgm--1.2.sql @@ -67,12 +67,12 @@ CREATE TYPE gtrgm ( ); -- support functions for gist -CREATE FUNCTION gtrgm_consistent(internal,text,int,oid,internal) +CREATE FUNCTION gtrgm_consistent(internal,text,smallint,oid,internal) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gtrgm_distance(internal,text,int,oid) +CREATE FUNCTION gtrgm_distance(internal,text,smallint,oid,internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -97,8 +97,8 @@ RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; -CREATE FUNCTION gtrgm_union(bytea, internal) -RETURNS _int4 +CREATE FUNCTION gtrgm_union(internal, internal) +RETURNS gtrgm AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -112,8 +112,8 @@ CREATE OPERATOR CLASS gist_trgm_ops FOR TYPE text USING gist AS OPERATOR 1 % (text, text), - FUNCTION 1 gtrgm_consistent (internal, text, int, oid, internal), - FUNCTION 2 gtrgm_union (bytea, internal), + FUNCTION 1 gtrgm_consistent (internal, text, smallint, oid, internal), + FUNCTION 2 gtrgm_union (internal, internal), FUNCTION 3 gtrgm_compress (internal), FUNCTION 4 gtrgm_decompress (internal), FUNCTION 5 gtrgm_penalty (internal, internal, internal), @@ -130,7 +130,7 @@ ALTER OPERATOR FAMILY gist_trgm_ops USING gist ADD OPERATOR 2 <-> (text, text) FOR ORDER BY pg_catalog.float_ops, OPERATOR 3 pg_catalog.~~ (text, text), OPERATOR 4 pg_catalog.~~* (text, text), - FUNCTION 8 (text, text) gtrgm_distance (internal, text, int, oid); + FUNCTION 8 (text, text) gtrgm_distance (internal, text, smallint, oid, internal); -- Add operators that are new in 9.3. diff --git a/contrib/seg/seg--1.0.sql b/contrib/seg/seg--1.0.sql index 3230b94f409..0de0d461671 100644 --- a/contrib/seg/seg--1.0.sql +++ b/contrib/seg/seg--1.0.sql @@ -326,7 +326,7 @@ CREATE OPERATOR ~ ( -- define the GiST support methods -CREATE FUNCTION gseg_consistent(internal,seg,int,oid,internal) +CREATE FUNCTION gseg_consistent(internal,seg,smallint,oid,internal) RETURNS bool AS 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT; @@ -386,7 +386,7 @@ AS OPERATOR 8 <@ , OPERATOR 13 @ , OPERATOR 14 ~ , - FUNCTION 1 gseg_consistent (internal, seg, int, oid, internal), + FUNCTION 1 gseg_consistent (internal, seg, smallint, oid, internal), FUNCTION 2 gseg_union (internal, internal), FUNCTION 3 gseg_compress (internal), FUNCTION 4 gseg_decompress (internal), diff --git a/contrib/tsearch2/tsearch2--1.0.sql b/contrib/tsearch2/tsearch2--1.0.sql index 4777df8d914..6f473871cda 100644 --- a/contrib/tsearch2/tsearch2--1.0.sql +++ b/contrib/tsearch2/tsearch2--1.0.sql @@ -389,7 +389,7 @@ CREATE OPERATOR CLASS gist_tsvector_ops FOR TYPE tsvector USING gist AS OPERATOR 1 @@ (tsvector, tsquery), - FUNCTION 1 gtsvector_consistent (internal, gtsvector, int, oid, internal), + FUNCTION 1 gtsvector_consistent (internal, tsvector, smallint, oid, internal), FUNCTION 2 gtsvector_union (internal, internal), FUNCTION 3 gtsvector_compress (internal), FUNCTION 4 gtsvector_decompress (internal), @@ -536,7 +536,7 @@ FOR TYPE tsquery USING gist AS OPERATOR 7 @> (tsquery, tsquery), OPERATOR 8 <@ (tsquery, tsquery), - FUNCTION 1 gtsquery_consistent (internal, internal, int, oid, internal), + FUNCTION 1 gtsquery_consistent (internal, tsquery, smallint, oid, internal), FUNCTION 2 gtsquery_union (internal, internal), FUNCTION 3 gtsquery_compress (internal), FUNCTION 4 gtsquery_decompress (internal), diff --git a/doc/src/sgml/gist.sgml b/doc/src/sgml/gist.sgml index 2d1a5aa863f..b3cc347e5cc 100644 --- a/doc/src/sgml/gist.sgml +++ b/doc/src/sgml/gist.sgml @@ -359,9 +359,20 @@ my_consistent(PG_FUNCTION_ARGS) the value being looked up in the index. The StrategyNumber parameter indicates which operator of your operator class is being applied — it matches one of the operator numbers in the - CREATE OPERATOR CLASS command. Depending on what operators - you have included in the class, the data type of query could - vary with the operator, but the above skeleton assumes it doesn't. + CREATE OPERATOR CLASS command. + + + + Depending on which operators you have included in the class, the data + type of query could vary with the operator, since it will + be whatever type is on the righthand side of the operator, which might + be different from the indexed data type appearing on the lefthand side. + (The above code skeleton assumes that only one type is possible; if + not, fetching the query argument value would have to depend + on the operator.) It is recommended that the SQL declaration of + the consistent function use the opclass's indexed data + type for the query argument, even though the actual type + might be something else depending on the operator. @@ -381,7 +392,7 @@ my_consistent(PG_FUNCTION_ARGS) CREATE OR REPLACE FUNCTION my_union(internal, internal) -RETURNS internal +RETURNS storage_type AS 'MODULE_PATHNAME' LANGUAGE C STRICT; @@ -434,9 +445,21 @@ my_union(PG_FUNCTION_ARGS) - The union implementation function should return a - pointer to newly palloc()ed memory. You can't just - return whatever the input is. + The result of the union function must be a value of the + index's storage type, whatever that is (it might or might not be + different from the indexed column's type). The union + function should return a pointer to newly palloc()ed + memory. You can't just return the input value as-is, even if there is + no type change. + + + + As shown above, the union function's + first internal argument is actually + a GistEntryVector pointer. The second argument is a + pointer to an integer variable, which can be ignored. (It used to be + required that the union function store the size of its + result value into that variable, but this is no longer necessary.) @@ -576,6 +599,12 @@ my_penalty(PG_FUNCTION_ARGS) PG_RETURN_POINTER(penalty); } + + For historical reasons, the penalty function doesn't + just return a float result; instead it has to store the value + at the location indicated by the third argument. The return + value per se is ignored, though it's conventional to pass back the + address of that argument. @@ -615,9 +644,9 @@ Datum my_picksplit(PG_FUNCTION_ARGS) { GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0); + GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1); OffsetNumber maxoff = entryvec->n - 1; GISTENTRY *ent = entryvec->vector; - GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1); int i, nbytes; OffsetNumber *left, @@ -683,6 +712,11 @@ my_picksplit(PG_FUNCTION_ARGS) PG_RETURN_POINTER(v); } + + Notice that the picksplit function's result is delivered + by modifying the passed-in v structure. The return + value per se is ignored, though it's conventional to pass back the + address of v. @@ -700,13 +734,15 @@ my_picksplit(PG_FUNCTION_ARGS) Returns true if two index entries are identical, false otherwise. + (An index entry is a value of the index's storage type, + not necessarily the original indexed column's type.) The SQL declaration of the function must look like this: -CREATE OR REPLACE FUNCTION my_same(internal, internal, internal) +CREATE OR REPLACE FUNCTION my_same(storage_type, storage_type, internal) RETURNS internal AS 'MODULE_PATHNAME' LANGUAGE C STRICT; @@ -731,7 +767,9 @@ my_same(PG_FUNCTION_ARGS) For historical reasons, the same function doesn't just return a Boolean result; instead it has to store the flag - at the location indicated by the third argument. + at the location indicated by the third argument. The return + value per se is ignored, though it's conventional to pass back the + address of that argument. @@ -756,7 +794,7 @@ my_same(PG_FUNCTION_ARGS) The SQL declaration of the function must look like this: -CREATE OR REPLACE FUNCTION my_distance(internal, data_type, smallint, oid) +CREATE OR REPLACE FUNCTION my_distance(internal, data_type, smallint, oid, internal) RETURNS float8 AS 'MODULE_PATHNAME' LANGUAGE C STRICT; @@ -824,7 +862,7 @@ my_distance(PG_FUNCTION_ARGS) fetch - Converts the compressed index representation of the data item into the + Converts the compressed index representation of a data item into the original data type, for index-only scans. The returned data must be an exact, non-lossy copy of the originally indexed value. @@ -840,11 +878,12 @@ LANGUAGE C STRICT; The argument is a pointer to a GISTENTRY struct. On - entry, its 'key' field contains a non-NULL leaf datum in its + entry, its key field contains a non-NULL leaf datum in compressed form. The return value is another GISTENTRY - struct, whose 'key' field contains the same datum in the original, - uncompressed form. If the opclass' compress function does nothing for - leaf entries, the fetch method can return the argument as is. + struct, whose key field contains the same datum in its + original, uncompressed form. If the opclass's compress function does + nothing for leaf entries, the fetch method can return the + argument as-is. @@ -879,8 +918,8 @@ my_fetch(PG_FUNCTION_ARGS) If the compress method is lossy for leaf entries, the operator class - cannot support index-only scans, and must not define a 'fetch' - function. + cannot support index-only scans, and must not define + a fetch function. diff --git a/doc/src/sgml/ref/create_opclass.sgml b/doc/src/sgml/ref/create_opclass.sgml index b21a1a13b32..527f33c7a80 100644 --- a/doc/src/sgml/ref/create_opclass.sgml +++ b/doc/src/sgml/ref/create_opclass.sgml @@ -289,7 +289,7 @@ CREATE OPERATOR CLASS gist__int_ops OPERATOR 7 @>, OPERATOR 8 <@, 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), diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 41b83431b61..81383835c88 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -217,7 +217,7 @@ gistindex_keytest(IndexScanDesc scan, key->sk_collation, PointerGetDatum(&de), key->sk_argument, - Int32GetDatum(key->sk_strategy), + Int16GetDatum(key->sk_strategy), ObjectIdGetDatum(key->sk_subtype), PointerGetDatum(&recheck)); @@ -280,7 +280,7 @@ gistindex_keytest(IndexScanDesc scan, key->sk_collation, PointerGetDatum(&de), key->sk_argument, - Int32GetDatum(key->sk_strategy), + Int16GetDatum(key->sk_strategy), ObjectIdGetDatum(key->sk_subtype), PointerGetDatum(&recheck)); *recheck_distances_p |= recheck; diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c index 1da9f87321f..e8213e2baff 100644 --- a/src/backend/access/gist/gistproc.c +++ b/src/backend/access/gist/gistproc.c @@ -1489,12 +1489,10 @@ gist_point_distance(PG_FUNCTION_ARGS) * This is a lower bound estimate of distance from point to indexed geometric * type. */ -Datum -gist_bbox_distance(PG_FUNCTION_ARGS) +static double +gist_bbox_distance(GISTENTRY *entry, Datum query, + StrategyNumber strategy, bool *recheck) { - GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); - StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); - bool *recheck = (bool *) PG_GETARG_POINTER(4); double distance; StrategyNumber strategyGroup = strategy / GeoStrategyNumberOffset; @@ -1506,12 +1504,44 @@ gist_bbox_distance(PG_FUNCTION_ARGS) case PointStrategyNumberGroup: distance = computeDistance(false, DatumGetBoxP(entry->key), - PG_GETARG_POINT_P(1)); + DatumGetPointP(query)); break; default: - elog(ERROR, "unknown strategy number: %d", strategy); + elog(ERROR, "unrecognized strategy number: %d", strategy); distance = 0.0; /* keep compiler quiet */ } + return distance; +} + +Datum +gist_circle_distance(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + Datum query = PG_GETARG_DATUM(1); + StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); + double distance; + + distance = gist_bbox_distance(entry, query, strategy, recheck); + + PG_RETURN_FLOAT8(distance); +} + +Datum +gist_poly_distance(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + Datum query = PG_GETARG_DATUM(1); + StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); + double distance; + + distance = gist_bbox_distance(entry, query, strategy, recheck); + PG_RETURN_FLOAT8(distance); } diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 54b9944c415..58e866658ea 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201601171 +#define CATALOG_VERSION_NO 201601191 #endif diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h index b284125ad82..e75da76b993 100644 --- a/src/include/catalog/pg_amproc.h +++ b/src/include/catalog/pg_amproc.h @@ -217,7 +217,7 @@ DATA(insert ( 2595 718 718 4 2580 )); DATA(insert ( 2595 718 718 5 2581 )); DATA(insert ( 2595 718 718 6 2582 )); DATA(insert ( 2595 718 718 7 2584 )); -DATA(insert ( 2595 718 718 8 3288 )); +DATA(insert ( 2595 718 718 8 3280 )); DATA(insert ( 3655 3614 3614 1 3654 )); DATA(insert ( 3655 3614 3614 2 3651 )); DATA(insert ( 3655 3614 3614 3 3648 )); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 3df5ac50b60..6beefa2ccf0 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2156,9 +2156,9 @@ DATA(insert OID = 4063 ( inet_merge PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 DESCR("the smallest network which includes both of the given networks"); /* GiST support for inet and cidr */ -DATA(insert OID = 3553 ( inet_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 869 23 26 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_consistent _null_ _null_ _null_ )); +DATA(insert OID = 3553 ( inet_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 869 21 26 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_consistent _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 3554 ( inet_gist_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_union _null_ _null_ _null_ )); +DATA(insert OID = 3554 ( inet_gist_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 869 "2281 2281" _null_ _null_ _null_ _null_ _null_ inet_gist_union _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3555 ( inet_gist_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ inet_gist_compress _null_ _null_ _null_ )); DESCR("GiST support"); @@ -4072,7 +4072,7 @@ DATA(insert OID = 2587 ( circle_overbelow PGNSP PGUID 12 1 0 0 0 f f f f t f i DATA(insert OID = 2588 ( circle_overabove PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "718 718" _null_ _null_ _null_ _null_ _null_ circle_overabove _null_ _null_ _null_ )); /* support functions for GiST r-tree emulation */ -DATA(insert OID = 2578 ( gist_box_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 603 23 26 2281" _null_ _null_ _null_ _null_ _null_ gist_box_consistent _null_ _null_ _null_ )); +DATA(insert OID = 2578 ( gist_box_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 603 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_box_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2579 ( gist_box_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_box_compress _null_ _null_ _null_ )); DESCR("GiST support"); @@ -4088,11 +4088,11 @@ DATA(insert OID = 2583 ( gist_box_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s DESCR("GiST support"); DATA(insert OID = 2584 ( gist_box_same PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "603 603 2281" _null_ _null_ _null_ _null_ _null_ gist_box_same _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 2585 ( gist_poly_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 604 23 26 2281" _null_ _null_ _null_ _null_ _null_ gist_poly_consistent _null_ _null_ _null_ )); +DATA(insert OID = 2585 ( gist_poly_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 604 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_poly_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2586 ( gist_poly_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_poly_compress _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 2591 ( gist_circle_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 718 23 26 2281" _null_ _null_ _null_ _null_ _null_ gist_circle_consistent _null_ _null_ _null_ )); +DATA(insert OID = 2591 ( gist_circle_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 718 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_circle_consistent _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 2592 ( gist_circle_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_circle_compress _null_ _null_ _null_ )); DESCR("GiST support"); @@ -4100,11 +4100,13 @@ DATA(insert OID = 1030 ( gist_point_compress PGNSP PGUID 12 1 0 0 0 f f f f t f DESCR("GiST support"); DATA(insert OID = 3282 ( gist_point_fetch PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ gist_point_fetch _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 2179 ( gist_point_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 600 23 26 2281" _null_ _null_ _null_ _null_ _null_ gist_point_consistent _null_ _null_ _null_ )); +DATA(insert OID = 2179 ( gist_point_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 600 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_point_consistent _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 3064 ( gist_point_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i s 4 0 701 "2281 600 23 26" _null_ _null_ _null_ _null_ _null_ gist_point_distance _null_ _null_ _null_ )); +DATA(insert OID = 3064 ( gist_point_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 701 "2281 600 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_point_distance _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 3288 ( gist_bbox_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i s 4 0 701 "2281 600 23 26" _null_ _null_ _null_ _null_ _null_ gist_bbox_distance _null_ _null_ _null_ )); +DATA(insert OID = 3280 ( gist_circle_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 701 "2281 718 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_circle_distance _null_ _null_ _null_ )); +DESCR("GiST support"); +DATA(insert OID = 3288 ( gist_poly_distance PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 701 "2281 604 21 26 2281" _null_ _null_ _null_ _null_ _null_ gist_poly_distance _null_ _null_ _null_ )); DESCR("GiST support"); /* GIN array support */ @@ -4470,13 +4472,13 @@ DATA(insert OID = 3649 ( gtsvector_decompress PGNSP PGUID 12 1 0 0 0 f f f f t DESCR("GiST tsvector support"); DATA(insert OID = 3650 ( gtsvector_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_picksplit _null_ _null_ _null_ )); DESCR("GiST tsvector support"); -DATA(insert OID = 3651 ( gtsvector_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_union _null_ _null_ _null_ )); +DATA(insert OID = 3651 ( gtsvector_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3642 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_union _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3652 ( gtsvector_same PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "3642 3642 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_same _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3653 ( gtsvector_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_penalty _null_ _null_ _null_ )); DESCR("GiST tsvector support"); -DATA(insert OID = 3654 ( gtsvector_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3642 23 26 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_consistent _null_ _null_ _null_ )); +DATA(insert OID = 3654 ( gtsvector_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3614 21 26 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_consistent _null_ _null_ _null_ )); DESCR("GiST tsvector support"); DATA(insert OID = 3656 ( gin_extract_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "3614 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsvector _null_ _null_ _null_ )); @@ -4530,13 +4532,13 @@ DATA(insert OID = 3696 ( gtsquery_decompress PGNSP PGUID 12 1 0 0 0 f f f f t DESCR("GiST tsquery support"); DATA(insert OID = 3697 ( gtsquery_picksplit PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_picksplit _null_ _null_ _null_ )); DESCR("GiST tsquery support"); -DATA(insert OID = 3698 ( gtsquery_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_union _null_ _null_ _null_ )); +DATA(insert OID = 3698 ( gtsquery_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_union _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3699 ( gtsquery_same PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "20 20 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_same _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3700 ( gtsquery_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_penalty _null_ _null_ _null_ )); DESCR("GiST tsquery support"); -DATA(insert OID = 3701 ( gtsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 2281 23 26 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_consistent _null_ _null_ _null_ )); +DATA(insert OID = 3701 ( gtsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3615 21 26 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_consistent _null_ _null_ _null_ )); DESCR("GiST tsquery support"); DATA(insert OID = 3686 ( tsmatchsel PGNSP PGUID 12 1 0 0 0 f f f f t f s s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_ tsmatchsel _null_ _null_ _null_ )); @@ -4923,9 +4925,9 @@ DATA(insert OID = 3871 ( range_lt PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 DATA(insert OID = 3872 ( range_le PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_le _null_ _null_ _null_ )); DATA(insert OID = 3873 ( range_ge PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_ge _null_ _null_ _null_ )); DATA(insert OID = 3874 ( range_gt PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3831 3831" _null_ _null_ _null_ _null_ _null_ range_gt _null_ _null_ _null_ )); -DATA(insert OID = 3875 ( range_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3831 23 26 2281" _null_ _null_ _null_ _null_ _null_ range_gist_consistent _null_ _null_ _null_ )); +DATA(insert OID = 3875 ( range_gist_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3831 21 26 2281" _null_ _null_ _null_ _null_ _null_ range_gist_consistent _null_ _null_ _null_ )); DESCR("GiST support"); -DATA(insert OID = 3876 ( range_gist_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ _null_ range_gist_union _null_ _null_ _null_ )); +DATA(insert OID = 3876 ( range_gist_union PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3831 "2281 2281" _null_ _null_ _null_ _null_ _null_ range_gist_union _null_ _null_ _null_ )); DESCR("GiST support"); DATA(insert OID = 3877 ( range_gist_compress PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2281 "2281" _null_ _null_ _null_ _null_ _null_ range_gist_compress _null_ _null_ _null_ )); DESCR("GiST support"); diff --git a/src/include/utils/geo_decls.h b/src/include/utils/geo_decls.h index 85aee22cded..9d8d660d157 100644 --- a/src/include/utils/geo_decls.h +++ b/src/include/utils/geo_decls.h @@ -417,12 +417,13 @@ extern Datum gist_box_same(PG_FUNCTION_ARGS); extern Datum gist_box_fetch(PG_FUNCTION_ARGS); extern Datum gist_poly_compress(PG_FUNCTION_ARGS); extern Datum gist_poly_consistent(PG_FUNCTION_ARGS); +extern Datum gist_poly_distance(PG_FUNCTION_ARGS); extern Datum gist_circle_compress(PG_FUNCTION_ARGS); extern Datum gist_circle_consistent(PG_FUNCTION_ARGS); +extern Datum gist_circle_distance(PG_FUNCTION_ARGS); extern Datum gist_point_compress(PG_FUNCTION_ARGS); extern Datum gist_point_consistent(PG_FUNCTION_ARGS); extern Datum gist_point_distance(PG_FUNCTION_ARGS); -extern Datum gist_bbox_distance(PG_FUNCTION_ARGS); extern Datum gist_point_fetch(PG_FUNCTION_ARGS); diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 79c13211ec4..45f13f3d067 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -291,8 +291,8 @@ WHERE p1.prorettype = 'internal'::regtype AND NOT -- Look for functions that return a polymorphic type and do not have any -- polymorphic argument. Calls of such functions would be unresolvable --- at parse time. As of 9.4 this query should find only some input functions --- associated with these pseudotypes. +-- at parse time. As of 9.6 this query should find only some input functions +-- and GiST support functions associated with these pseudotypes. SELECT p1.oid, p1.proname FROM pg_proc as p1 WHERE p1.prorettype IN @@ -305,8 +305,8 @@ WHERE p1.prorettype IN 'anyenum'::regtype = ANY (p1.proargtypes) OR 'anyrange'::regtype = ANY (p1.proargtypes)) ORDER BY 2; - oid | proname -------+---------------- + oid | proname +------+------------------ 2296 | anyarray_in 2502 | anyarray_recv 2312 | anyelement_in @@ -317,9 +317,10 @@ ORDER BY 2; 2400 | array_recv 3506 | enum_in 3532 | enum_recv + 3876 | range_gist_union 3834 | range_in 3836 | range_recv -(12 rows) +(13 rows) -- Look for functions that accept cstring and are neither datatype input -- functions nor encoding conversion functions. It's almost never a good diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index 257a4a2765b..c42c8a35616 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -237,8 +237,8 @@ WHERE p1.prorettype = 'internal'::regtype AND NOT -- Look for functions that return a polymorphic type and do not have any -- polymorphic argument. Calls of such functions would be unresolvable --- at parse time. As of 9.4 this query should find only some input functions --- associated with these pseudotypes. +-- at parse time. As of 9.6 this query should find only some input functions +-- and GiST support functions associated with these pseudotypes. SELECT p1.oid, p1.proname FROM pg_proc as p1