2001-03-18 05:59:42 +08:00
|
|
|
-- Create the user-defined type for the 1-D integer arrays (_int4)
|
2001-01-12 08:16:26 +08:00
|
|
|
--
|
|
|
|
BEGIN TRANSACTION;
|
|
|
|
|
2001-09-23 12:16:16 +08:00
|
|
|
-- Query type
|
|
|
|
CREATE FUNCTION bqarr_in(opaque)
|
|
|
|
RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c' with (isstrict);
|
|
|
|
|
|
|
|
CREATE FUNCTION bqarr_out(opaque)
|
|
|
|
RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c' with (isstrict);
|
|
|
|
|
|
|
|
CREATE TYPE query_int (
|
|
|
|
internallength = -1,
|
|
|
|
input = bqarr_in,
|
|
|
|
output = bqarr_out
|
|
|
|
);
|
|
|
|
|
|
|
|
--only for debug
|
|
|
|
CREATE FUNCTION querytree(query_int)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME'
|
|
|
|
LANGUAGE 'c' with (isstrict);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE FUNCTION boolop(_int4, query_int) RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
|
|
|
|
|
|
|
COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array';
|
|
|
|
|
|
|
|
CREATE FUNCTION rboolop(query_int, _int4) RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
|
|
|
|
|
|
|
COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array';
|
|
|
|
|
|
|
|
CREATE OPERATOR @@ (
|
|
|
|
LEFTARG = _int4, RIGHTARG = query_int, PROCEDURE = boolop,
|
|
|
|
COMMUTATOR = '~~', RESTRICT = contsel, JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~~ (
|
|
|
|
LEFTARG = query_int, RIGHTARG = _int4, PROCEDURE = rboolop,
|
|
|
|
COMMUTATOR = '@@', RESTRICT = contsel, JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2001-01-12 08:16:26 +08:00
|
|
|
--
|
|
|
|
-- External C-functions for R-tree methods
|
|
|
|
--
|
|
|
|
|
|
|
|
-- Comparison methods
|
|
|
|
|
|
|
|
CREATE FUNCTION _int_contains(_int4, _int4) RETURNS bool
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-08-11 02:57:42 +08:00
|
|
|
COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains';
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION _int_contained(_int4, _int4) RETURNS bool
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-08-11 02:57:42 +08:00
|
|
|
COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in';
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION _int_overlap(_int4, _int4) RETURNS bool
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-08-11 02:57:42 +08:00
|
|
|
COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps';
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION _int_same(_int4, _int4) RETURNS bool
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-08-11 02:57:42 +08:00
|
|
|
COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as';
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION _int_different(_int4, _int4) RETURNS bool
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-08-11 02:57:42 +08:00
|
|
|
COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
-- support routines for indexing
|
|
|
|
|
|
|
|
CREATE FUNCTION _int_union(_int4, _int4) RETURNS _int4
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION _int_inter(_int4, _int4) RETURNS _int4
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- OPERATORS
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE OPERATOR && (
|
|
|
|
LEFTARG = _int4, RIGHTARG = _int4, PROCEDURE = _int_overlap,
|
|
|
|
COMMUTATOR = '&&',
|
|
|
|
RESTRICT = contsel, JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
--CREATE OPERATOR = (
|
|
|
|
-- LEFTARG = _int4, RIGHTARG = _int4, PROCEDURE = _int_same,
|
|
|
|
-- COMMUTATOR = '=', NEGATOR = '<>',
|
|
|
|
-- RESTRICT = eqsel, JOIN = eqjoinsel,
|
|
|
|
-- SORT1 = '<', SORT2 = '<'
|
|
|
|
--);
|
|
|
|
|
|
|
|
CREATE OPERATOR <> (
|
|
|
|
LEFTARG = _int4, RIGHTARG = _int4, PROCEDURE = _int_different,
|
|
|
|
COMMUTATOR = '<>', NEGATOR = '=',
|
|
|
|
RESTRICT = neqsel, JOIN = neqjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR @ (
|
|
|
|
LEFTARG = _int4, RIGHTARG = _int4, PROCEDURE = _int_contains,
|
|
|
|
COMMUTATOR = '~', RESTRICT = contsel, JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
|
|
|
LEFTARG = _int4, RIGHTARG = _int4, PROCEDURE = _int_contained,
|
|
|
|
COMMUTATOR = '@', RESTRICT = contsel, JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
-- define the GiST support methods
|
|
|
|
CREATE FUNCTION g_int_consistent(opaque,_int4,int4) RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_int_compress(opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_int_decompress(opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_int_penalty(opaque,opaque,opaque) RETURNS opaque
|
2001-08-23 02:24:26 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION g_int_picksplit(opaque, opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_int_union(bytea, opaque) RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_int_same(_int4, _int4, opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
|
|
|
|
-- register the default opclass for indexing
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_opclass (opcamid, opcname, opcintype, opcdefault, opckeytype)
|
|
|
|
VALUES (
|
|
|
|
(SELECT oid FROM pg_am WHERE amname = 'gist'),
|
|
|
|
'gist__int_ops',
|
|
|
|
(SELECT oid FROM pg_type WHERE typname = '_int4'),
|
|
|
|
true,
|
2001-08-23 02:24:26 +08:00
|
|
|
0);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
-- get the comparators for _intments and store them in a tmp table
|
|
|
|
SELECT o.oid AS opoid, o.oprname
|
2001-08-22 00:36:06 +08:00
|
|
|
INTO TEMP TABLE _int_ops_tmp
|
2001-09-23 12:16:16 +08:00
|
|
|
FROM pg_operator o, pg_type t, pg_type tq
|
|
|
|
WHERE o.oprleft = t.oid and ( o.oprright = t.oid or o.oprright=tq.oid )
|
|
|
|
and t.typname = '_int4'
|
|
|
|
and tq.typname='query_int';
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
-- make sure we have the right operators
|
|
|
|
-- SELECT * from _int_ops_tmp;
|
|
|
|
|
|
|
|
-- using the tmp table, generate the amop entries
|
|
|
|
|
|
|
|
-- _int_overlap
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
2001-10-01 00:16:44 +08:00
|
|
|
SELECT opcl.oid, 3, false, c.opoid
|
2001-08-22 00:36:06 +08:00
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and c.oprname = '&&';
|
|
|
|
|
|
|
|
-- _int_same
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
2001-10-01 00:16:44 +08:00
|
|
|
SELECT opcl.oid, 6, false, c.opoid
|
2001-08-22 00:36:06 +08:00
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and c.oprname = '=';
|
|
|
|
|
|
|
|
-- _int_contains
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
2001-10-01 00:16:44 +08:00
|
|
|
SELECT opcl.oid, 7, false, c.opoid
|
2001-08-22 00:36:06 +08:00
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and c.oprname = '@';
|
|
|
|
|
|
|
|
-- _int_contained
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
2001-10-01 00:16:44 +08:00
|
|
|
SELECT opcl.oid, 8, false, c.opoid
|
2001-08-22 00:36:06 +08:00
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and c.oprname = '~';
|
|
|
|
|
2001-09-23 12:16:16 +08:00
|
|
|
--boolean search
|
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
2001-10-01 00:16:44 +08:00
|
|
|
SELECT opcl.oid, 20, false, c.opoid
|
2001-09-23 12:16:16 +08:00
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
|
|
|
and c.oprname = '@@';
|
|
|
|
|
2001-01-12 08:16:26 +08:00
|
|
|
DROP TABLE _int_ops_tmp;
|
|
|
|
|
|
|
|
|
|
|
|
-- add the entries to amproc for the support methods
|
|
|
|
-- note the amprocnum numbers associated with each are specific!
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 1, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_consistent';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 2, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_union';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 3, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_compress';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 4, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_decompress';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 5, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_penalty';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 6, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_picksplit';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 7, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__int_ops'
|
2001-01-12 08:16:26 +08:00
|
|
|
and proname = 'g_int_same';
|
|
|
|
|
2001-03-18 05:59:42 +08:00
|
|
|
|
|
|
|
---------------------------------------------
|
|
|
|
-- intbig
|
|
|
|
---------------------------------------------
|
|
|
|
-- define the GiST support methods
|
|
|
|
CREATE FUNCTION g_intbig_consistent(opaque,_int4,int4) RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_intbig_compress(opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_intbig_decompress(opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_intbig_penalty(opaque,opaque,opaque) RETURNS opaque
|
2001-08-10 22:34:28 +08:00
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c' with (isstrict);
|
2001-03-18 05:59:42 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION g_intbig_picksplit(opaque, opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_intbig_union(bytea, opaque) RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
|
|
|
CREATE FUNCTION g_intbig_same(_int4, _int4, opaque) RETURNS opaque
|
|
|
|
AS 'MODULE_PATHNAME' LANGUAGE 'c';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
-- register the opclass for indexing (not as default)
|
|
|
|
INSERT INTO pg_opclass (opcamid, opcname, opcintype, opcdefault, opckeytype)
|
|
|
|
VALUES (
|
|
|
|
(SELECT oid FROM pg_am WHERE amname = 'gist'),
|
|
|
|
'gist__intbig_ops',
|
|
|
|
(SELECT oid FROM pg_type WHERE typname = '_int4'),
|
|
|
|
false,
|
2001-08-23 02:24:26 +08:00
|
|
|
0);
|
2001-03-18 05:59:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
-- get the comparators for _intments and store them in a tmp table
|
|
|
|
SELECT o.oid AS opoid, o.oprname
|
2001-08-22 00:36:06 +08:00
|
|
|
INTO TEMP TABLE _int_ops_tmp
|
2001-09-23 12:16:16 +08:00
|
|
|
FROM pg_operator o, pg_type t, pg_type tq
|
|
|
|
WHERE o.oprleft = t.oid and ( o.oprright = t.oid or o.oprright=tq.oid )
|
|
|
|
and t.typname = '_int4'
|
|
|
|
and tq.typname='query_int';
|
2001-03-18 05:59:42 +08:00
|
|
|
|
|
|
|
-- make sure we have the right operators
|
|
|
|
-- SELECT * from _int_ops_tmp;
|
|
|
|
|
|
|
|
-- using the tmp table, generate the amop entries
|
2001-08-22 00:36:06 +08:00
|
|
|
-- note: these operators are all lossy
|
2001-03-18 05:59:42 +08:00
|
|
|
|
|
|
|
-- _int_overlap
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
|
|
|
SELECT opcl.oid, 3, true, c.opoid
|
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and c.oprname = '&&';
|
|
|
|
|
|
|
|
-- _int_contains
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
|
|
|
SELECT opcl.oid, 7, true, c.opoid
|
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and c.oprname = '@';
|
|
|
|
|
|
|
|
-- _int_contained
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
|
|
|
SELECT opcl.oid, 8, true, c.opoid
|
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and c.oprname = '~';
|
|
|
|
|
2001-09-23 12:16:16 +08:00
|
|
|
--boolean search
|
|
|
|
INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
|
|
|
|
SELECT opcl.oid, 20, true, c.opoid
|
|
|
|
FROM pg_opclass opcl, _int_ops_tmp c
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
|
|
|
and c.oprname = '@@';
|
|
|
|
|
2001-03-18 05:59:42 +08:00
|
|
|
DROP TABLE _int_ops_tmp;
|
|
|
|
|
|
|
|
|
|
|
|
-- add the entries to amproc for the support methods
|
|
|
|
-- note the amprocnum numbers associated with each are specific!
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 1, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_consistent';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 2, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_union';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 3, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_compress';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 4, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_decompress';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 5, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_penalty';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 6, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_picksplit';
|
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
|
|
|
|
SELECT opcl.oid, 7, pro.oid
|
|
|
|
FROM pg_opclass opcl, pg_proc pro
|
|
|
|
WHERE
|
|
|
|
opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
|
|
|
|
and opcname = 'gist__intbig_ops'
|
2001-03-18 05:59:42 +08:00
|
|
|
and proname = 'g_intbig_same';
|
|
|
|
|
2001-01-12 08:16:26 +08:00
|
|
|
END TRANSACTION;
|