Commit 2e0c47e5 authored by Tom Lane's avatar Tom Lane

Support functions for index opclasses should be immutable.

Found by running opr_sanity on contrib modules.
parent d80d8acb
...@@ -12,12 +12,12 @@ BEGIN; ...@@ -12,12 +12,12 @@ BEGIN;
CREATE FUNCTION bqarr_in(cstring) CREATE FUNCTION bqarr_in(cstring)
RETURNS query_int RETURNS query_int
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION bqarr_out(query_int) CREATE FUNCTION bqarr_out(query_int)
RETURNS cstring RETURNS cstring
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE TYPE query_int ( CREATE TYPE query_int (
INTERNALLENGTH = -1, INTERNALLENGTH = -1,
...@@ -29,20 +29,20 @@ CREATE TYPE query_int ( ...@@ -29,20 +29,20 @@ CREATE TYPE query_int (
CREATE FUNCTION querytree(query_int) CREATE FUNCTION querytree(query_int)
RETURNS text RETURNS text
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION boolop(_int4, query_int) CREATE FUNCTION boolop(_int4, query_int)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array'; COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array';
CREATE FUNCTION rboolop(query_int, _int4) CREATE FUNCTION rboolop(query_int, _int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array'; COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array';
...@@ -74,35 +74,35 @@ CREATE OPERATOR ~~ ( ...@@ -74,35 +74,35 @@ CREATE OPERATOR ~~ (
CREATE FUNCTION _int_contains(_int4, _int4) CREATE FUNCTION _int_contains(_int4, _int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains'; COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains';
CREATE FUNCTION _int_contained(_int4, _int4) CREATE FUNCTION _int_contained(_int4, _int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in'; COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in';
CREATE FUNCTION _int_overlap(_int4, _int4) CREATE FUNCTION _int_overlap(_int4, _int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps'; COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps';
CREATE FUNCTION _int_same(_int4, _int4) CREATE FUNCTION _int_same(_int4, _int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as'; COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as';
CREATE FUNCTION _int_different(_int4, _int4) CREATE FUNCTION _int_different(_int4, _int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different'; COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
...@@ -111,12 +111,12 @@ COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different'; ...@@ -111,12 +111,12 @@ COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
CREATE FUNCTION _int_union(_int4, _int4) CREATE FUNCTION _int_union(_int4, _int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION _int_inter(_int4, _int4) CREATE FUNCTION _int_inter(_int4, _int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
-- --
-- OPERATORS -- OPERATORS
...@@ -194,12 +194,12 @@ CREATE OPERATOR ~ ( ...@@ -194,12 +194,12 @@ CREATE OPERATOR ~ (
CREATE FUNCTION intset(int4) CREATE FUNCTION intset(int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION icount(_int4) CREATE FUNCTION icount(_int4)
RETURNS int4 RETURNS int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR # ( CREATE OPERATOR # (
RIGHTARG = _int4, RIGHTARG = _int4,
...@@ -209,32 +209,32 @@ CREATE OPERATOR # ( ...@@ -209,32 +209,32 @@ CREATE OPERATOR # (
CREATE FUNCTION sort(_int4, text) CREATE FUNCTION sort(_int4, text)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION sort(_int4) CREATE FUNCTION sort(_int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION sort_asc(_int4) CREATE FUNCTION sort_asc(_int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION sort_desc(_int4) CREATE FUNCTION sort_desc(_int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION uniq(_int4) CREATE FUNCTION uniq(_int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION idx(_int4, int4) CREATE FUNCTION idx(_int4, int4)
RETURNS int4 RETURNS int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR # ( CREATE OPERATOR # (
LEFTARG = _int4, LEFTARG = _int4,
...@@ -245,17 +245,17 @@ CREATE OPERATOR # ( ...@@ -245,17 +245,17 @@ CREATE OPERATOR # (
CREATE FUNCTION subarray(_int4, int4, int4) CREATE FUNCTION subarray(_int4, int4, int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION subarray(_int4, int4) CREATE FUNCTION subarray(_int4, int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION intarray_push_elem(_int4, int4) CREATE FUNCTION intarray_push_elem(_int4, int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR + ( CREATE OPERATOR + (
LEFTARG = _int4, LEFTARG = _int4,
...@@ -266,7 +266,7 @@ CREATE OPERATOR + ( ...@@ -266,7 +266,7 @@ CREATE OPERATOR + (
CREATE FUNCTION intarray_push_array(_int4, _int4) CREATE FUNCTION intarray_push_array(_int4, _int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR + ( CREATE OPERATOR + (
LEFTARG = _int4, LEFTARG = _int4,
...@@ -278,7 +278,7 @@ CREATE OPERATOR + ( ...@@ -278,7 +278,7 @@ CREATE OPERATOR + (
CREATE FUNCTION intarray_del_elem(_int4, int4) CREATE FUNCTION intarray_del_elem(_int4, int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR - ( CREATE OPERATOR - (
LEFTARG = _int4, LEFTARG = _int4,
...@@ -289,7 +289,7 @@ CREATE OPERATOR - ( ...@@ -289,7 +289,7 @@ CREATE OPERATOR - (
CREATE FUNCTION intset_union_elem(_int4, int4) CREATE FUNCTION intset_union_elem(_int4, int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR | ( CREATE OPERATOR | (
LEFTARG = _int4, LEFTARG = _int4,
...@@ -307,7 +307,7 @@ CREATE OPERATOR | ( ...@@ -307,7 +307,7 @@ CREATE OPERATOR | (
CREATE FUNCTION intset_subtract(_int4, _int4) CREATE FUNCTION intset_subtract(_int4, _int4)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR - ( CREATE OPERATOR - (
LEFTARG = _int4, LEFTARG = _int4,
...@@ -327,37 +327,37 @@ CREATE OPERATOR & ( ...@@ -327,37 +327,37 @@ CREATE OPERATOR & (
CREATE FUNCTION g_int_consistent(internal,_int4,int4) CREATE FUNCTION g_int_consistent(internal,_int4,int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_int_compress(internal) CREATE FUNCTION g_int_compress(internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_int_decompress(internal) CREATE FUNCTION g_int_decompress(internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_int_penalty(internal,internal,internal) CREATE FUNCTION g_int_penalty(internal,internal,internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT; LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION g_int_picksplit(internal, internal) CREATE FUNCTION g_int_picksplit(internal, internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_int_union(internal, internal) CREATE FUNCTION g_int_union(internal, internal)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_int_same(_int4, _int4, internal) CREATE FUNCTION g_int_same(_int4, _int4, internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
-- Create the operator class for indexing -- Create the operator class for indexing
...@@ -388,12 +388,12 @@ DEFAULT FOR TYPE _int4 USING gist AS ...@@ -388,12 +388,12 @@ DEFAULT FOR TYPE _int4 USING gist AS
CREATE FUNCTION _intbig_in(cstring) CREATE FUNCTION _intbig_in(cstring)
RETURNS intbig_gkey RETURNS intbig_gkey
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE FUNCTION _intbig_out(intbig_gkey) CREATE FUNCTION _intbig_out(intbig_gkey)
RETURNS cstring RETURNS cstring
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; LANGUAGE C STRICT IMMUTABLE;
CREATE TYPE intbig_gkey ( CREATE TYPE intbig_gkey (
INTERNALLENGTH = -1, INTERNALLENGTH = -1,
...@@ -404,37 +404,37 @@ CREATE TYPE intbig_gkey ( ...@@ -404,37 +404,37 @@ CREATE TYPE intbig_gkey (
CREATE FUNCTION g_intbig_consistent(internal,internal,int4) CREATE FUNCTION g_intbig_consistent(internal,internal,int4)
RETURNS bool RETURNS bool
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_intbig_compress(internal) CREATE FUNCTION g_intbig_compress(internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_intbig_decompress(internal) CREATE FUNCTION g_intbig_decompress(internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_intbig_penalty(internal,internal,internal) CREATE FUNCTION g_intbig_penalty(internal,internal,internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT; LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION g_intbig_picksplit(internal, internal) CREATE FUNCTION g_intbig_picksplit(internal, internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_intbig_union(internal, internal) CREATE FUNCTION g_intbig_union(internal, internal)
RETURNS _int4 RETURNS _int4
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION g_intbig_same(internal, internal, internal) CREATE FUNCTION g_intbig_same(internal, internal, internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
-- register the opclass for indexing (not as default) -- register the opclass for indexing (not as default)
...@@ -462,12 +462,12 @@ AS ...@@ -462,12 +462,12 @@ AS
CREATE FUNCTION ginint4_queryextract(internal, internal, int2) CREATE FUNCTION ginint4_queryextract(internal, internal, int2)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE FUNCTION ginint4_consistent(internal, int2, internal) CREATE FUNCTION ginint4_consistent(internal, int2, internal)
RETURNS internal RETURNS internal
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE C; LANGUAGE C IMMUTABLE;
CREATE OPERATOR CLASS gin__int_ops CREATE OPERATOR CLASS gin__int_ops
FOR TYPE _int4 USING gin FOR TYPE _int4 USING gin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment