2011-02-14 09:06:41 +08:00
|
|
|
/* contrib/intarray/intarray--1.0.sql */
|
2007-11-11 11:25:35 +08:00
|
|
|
|
2011-10-13 03:45:03 +08:00
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
|
|
\echo Use "CREATE EXTENSION intarray" to load this file. \quit
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
--
|
2001-03-18 05:59:42 +08:00
|
|
|
-- Create the user-defined type for the 1-D integer arrays (_int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
--
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-09-23 12:16:16 +08:00
|
|
|
-- Query type
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION bqarr_in(cstring)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS query_int
|
2001-09-23 12:16:16 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-09-23 12:16:16 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION bqarr_out(query_int)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS cstring
|
2001-09-23 12:16:16 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-09-23 12:16:16 +08:00
|
|
|
|
|
|
|
CREATE TYPE query_int (
|
2002-10-19 02:41:22 +08:00
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = bqarr_in,
|
|
|
|
OUTPUT = bqarr_out
|
2001-09-23 12:16:16 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--only for debug
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION querytree(query_int)
|
2001-09-23 12:16:16 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-09-23 12:16:16 +08:00
|
|
|
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION boolop(_int4, query_int)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-09-23 12:16:16 +08:00
|
|
|
|
|
|
|
COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array';
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION rboolop(query_int, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-09-23 12:16:16 +08:00
|
|
|
|
|
|
|
COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array';
|
|
|
|
|
|
|
|
CREATE OPERATOR @@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = query_int,
|
|
|
|
PROCEDURE = boolop,
|
|
|
|
COMMUTATOR = '~~',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2001-09-23 12:16:16 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = query_int,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = rboolop,
|
|
|
|
COMMUTATOR = '@@',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2001-09-23 12:16:16 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2001-01-12 08:16:26 +08:00
|
|
|
--
|
|
|
|
-- External C-functions for R-tree methods
|
|
|
|
--
|
|
|
|
|
|
|
|
-- Comparison methods
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_contains(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
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
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_contained(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
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
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_overlap(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
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
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_same(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
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
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_different(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
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
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_union(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
2006-02-28 00:09:50 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _int_inter(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- OPERATORS
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE OPERATOR && (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = _int_overlap,
|
|
|
|
COMMUTATOR = '&&',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2001-01-12 08:16:26 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--CREATE OPERATOR = (
|
2002-10-19 02:41:22 +08:00
|
|
|
-- LEFTARG = _int4,
|
|
|
|
-- RIGHTARG = _int4,
|
|
|
|
-- PROCEDURE = _int_same,
|
|
|
|
-- COMMUTATOR = '=',
|
|
|
|
-- NEGATOR = '<>',
|
|
|
|
-- RESTRICT = eqsel,
|
|
|
|
-- JOIN = eqjoinsel,
|
|
|
|
-- SORT1 = '<',
|
|
|
|
-- SORT2 = '<'
|
2001-01-12 08:16:26 +08:00
|
|
|
--);
|
|
|
|
|
2004-01-09 07:40:27 +08:00
|
|
|
--CREATE OPERATOR <> (
|
|
|
|
-- LEFTARG = _int4,
|
|
|
|
-- RIGHTARG = _int4,
|
|
|
|
-- PROCEDURE = _int_different,
|
|
|
|
-- COMMUTATOR = '<>',
|
|
|
|
-- NEGATOR = '=',
|
|
|
|
-- RESTRICT = neqsel,
|
|
|
|
-- JOIN = neqjoinsel
|
|
|
|
--);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2009-06-08 04:09:34 +08:00
|
|
|
CREATE OPERATOR @> (
|
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = _int_contains,
|
|
|
|
COMMUTATOR = '<@',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
2006-09-11 01:36:52 +08:00
|
|
|
|
2009-06-08 04:09:34 +08:00
|
|
|
CREATE OPERATOR <@ (
|
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = _int_contained,
|
|
|
|
COMMUTATOR = '@>',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
2006-09-11 01:36:52 +08:00
|
|
|
|
|
|
|
-- obsolete:
|
2001-01-12 08:16:26 +08:00
|
|
|
CREATE OPERATOR @ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = _int_contains,
|
|
|
|
COMMUTATOR = '~',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2001-01-12 08:16:26 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = _int_contained,
|
|
|
|
COMMUTATOR = '@',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2001-01-12 08:16:26 +08:00
|
|
|
);
|
|
|
|
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
--------------
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION intset(int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION icount(_int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR # (
|
2002-10-19 02:41:22 +08:00
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = icount
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION sort(_int4, text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION sort(_int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION sort_asc(_int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION sort_desc(_int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION uniq(_int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION idx(_int4, int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR # (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = int4,
|
|
|
|
PROCEDURE = idx
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION subarray(_int4, int4, int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION subarray(_int4, int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION intarray_push_elem(_int4, int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR + (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = int4,
|
|
|
|
PROCEDURE = intarray_push_elem
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION intarray_push_array(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
CREATE OPERATOR + (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
COMMUTATOR = +,
|
|
|
|
PROCEDURE = intarray_push_array
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION intarray_del_elem(_int4, int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
CREATE OPERATOR - (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = int4,
|
|
|
|
PROCEDURE = intarray_del_elem
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION intset_union_elem(_int4, int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
CREATE OPERATOR | (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = int4,
|
|
|
|
PROCEDURE = intset_union_elem
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR | (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
COMMUTATOR = |,
|
|
|
|
PROCEDURE = _int_union
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION intset_subtract(_int4, _int4)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
CREATE OPERATOR - (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
PROCEDURE = intset_subtract
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR & (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _int4,
|
|
|
|
RIGHTARG = _int4,
|
|
|
|
COMMUTATOR = &,
|
|
|
|
PROCEDURE = _int_inter
|
August 6, 2002
1. Reworked patch from Andrey Oktyabrski (ano@spider.ru) with
functions: icount, sort, sort_asc, uniq, idx, subarray
operations: #, +, -, |, &
FUNCTIONS:
int icount(int[]) - the number of elements in intarray
int[] sort(int[], 'asc' | 'desc') - sort intarray
int[] sort(int[]) - sort in ascending order
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
int[] uniq(int[]) - returns unique elements
int idx(int[], int item) - returns index of first intarray matching element
to item, or '0' if matching failed.
int[] subarray(int[],int START [, int LEN]) - returns part of intarray
starting from element number START (from 1)
and length LEN.
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
int[] @ int[] - contains - returns TRUE if left array contains right array
int[] ~ int[] - contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int[] - remove left array from right
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
Oleg Bartunov
2002-08-11 04:38:29 +08:00
|
|
|
);
|
|
|
|
--------------
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
-- define the GiST support methods
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_consistent(internal,_int4,int,oid,internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_compress(internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_decompress(internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_penalty(internal,internal,internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_picksplit(internal, internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_union(internal, internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_int_same(_int4, _int4, internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-01-12 08:16:26 +08:00
|
|
|
|
|
|
|
|
2002-07-30 06:14:11 +08:00
|
|
|
-- Create the operator class for indexing
|
|
|
|
|
|
|
|
CREATE OPERATOR CLASS gist__int_ops
|
2002-10-19 02:41:22 +08:00
|
|
|
DEFAULT FOR TYPE _int4 USING gist AS
|
2002-07-30 06:14:11 +08:00
|
|
|
OPERATOR 3 &&,
|
2008-04-15 01:05:34 +08:00
|
|
|
OPERATOR 6 = (anyarray, anyarray),
|
2009-06-08 04:09:34 +08:00
|
|
|
OPERATOR 7 @>,
|
|
|
|
OPERATOR 8 <@,
|
2006-09-11 01:36:52 +08:00
|
|
|
OPERATOR 13 @,
|
|
|
|
OPERATOR 14 ~,
|
2002-07-30 06:14:11 +08:00
|
|
|
OPERATOR 20 @@ (_int4, query_int),
|
2008-04-15 01:05:34 +08:00
|
|
|
FUNCTION 1 g_int_consistent (internal, _int4, int, oid, internal),
|
2004-03-30 23:45:33 +08:00
|
|
|
FUNCTION 2 g_int_union (internal, internal),
|
2002-08-22 08:01:51 +08:00
|
|
|
FUNCTION 3 g_int_compress (internal),
|
|
|
|
FUNCTION 4 g_int_decompress (internal),
|
|
|
|
FUNCTION 5 g_int_penalty (internal, internal, internal),
|
|
|
|
FUNCTION 6 g_int_picksplit (internal, internal),
|
|
|
|
FUNCTION 7 g_int_same (_int4, _int4, internal);
|
2001-01-12 08:16:26 +08:00
|
|
|
|
2001-03-18 05:59:42 +08:00
|
|
|
|
|
|
|
---------------------------------------------
|
|
|
|
-- intbig
|
|
|
|
---------------------------------------------
|
|
|
|
-- define the GiST support methods
|
2003-06-12 02:44:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _intbig_in(cstring)
|
2003-06-12 02:44:15 +08:00
|
|
|
RETURNS intbig_gkey
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-06-12 02:44:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _intbig_out(intbig_gkey)
|
2003-06-12 02:44:15 +08:00
|
|
|
RETURNS cstring
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-06-12 02:44:15 +08:00
|
|
|
|
|
|
|
CREATE TYPE intbig_gkey (
|
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = _intbig_in,
|
|
|
|
OUTPUT = _intbig_out
|
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_consistent(internal,internal,int,oid,internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_compress(internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_decompress(internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_penalty(internal,internal,internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 07:48:22 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_picksplit(internal, internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_union(internal, internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS _int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION g_intbig_same(internal, internal, internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2001-03-18 05:59:42 +08:00
|
|
|
|
2001-08-22 00:36:06 +08:00
|
|
|
-- register the opclass for indexing (not as default)
|
2002-07-30 06:14:11 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR CLASS gist__intbig_ops
|
2002-10-19 02:41:22 +08:00
|
|
|
FOR TYPE _int4 USING gist
|
|
|
|
AS
|
2008-04-15 01:05:34 +08:00
|
|
|
OPERATOR 3 &&,
|
|
|
|
OPERATOR 6 = (anyarray, anyarray),
|
2009-06-08 04:09:34 +08:00
|
|
|
OPERATOR 7 @>,
|
|
|
|
OPERATOR 8 <@,
|
2008-04-15 01:05:34 +08:00
|
|
|
OPERATOR 13 @,
|
|
|
|
OPERATOR 14 ~,
|
|
|
|
OPERATOR 20 @@ (_int4, query_int),
|
|
|
|
FUNCTION 1 g_intbig_consistent (internal, internal, int, oid, internal),
|
2004-03-30 23:45:33 +08:00
|
|
|
FUNCTION 2 g_intbig_union (internal, internal),
|
2002-08-22 08:01:51 +08:00
|
|
|
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),
|
2003-06-12 02:44:15 +08:00
|
|
|
FUNCTION 7 g_intbig_same (internal, internal, internal),
|
|
|
|
STORAGE intbig_gkey;
|
2006-05-04 00:31:07 +08:00
|
|
|
|
|
|
|
--GIN
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ginint4_queryextract(internal, internal, int2, internal, internal, internal, internal)
|
2006-05-04 00:31:07 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2006-05-04 00:31:07 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ginint4_consistent(internal, int2, internal, int4, internal, internal, internal, internal)
|
2009-03-26 06:19:02 +08:00
|
|
|
RETURNS bool
|
2006-05-04 00:31:07 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2009-06-12 02:30:03 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2006-05-04 00:31:07 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR CLASS gin__int_ops
|
2007-09-14 11:25:31 +08:00
|
|
|
FOR TYPE _int4 USING gin
|
2006-05-04 00:31:07 +08:00
|
|
|
AS
|
|
|
|
OPERATOR 3 &&,
|
2008-04-15 01:05:34 +08:00
|
|
|
OPERATOR 6 = (anyarray, anyarray),
|
2009-06-08 04:09:34 +08:00
|
|
|
OPERATOR 7 @>,
|
|
|
|
OPERATOR 8 <@,
|
2006-09-11 01:36:52 +08:00
|
|
|
OPERATOR 13 @,
|
2008-04-15 01:05:34 +08:00
|
|
|
OPERATOR 14 ~,
|
2006-05-04 00:31:07 +08:00
|
|
|
OPERATOR 20 @@ (_int4, query_int),
|
|
|
|
FUNCTION 1 btint4cmp (int4, int4),
|
2011-01-08 12:34:06 +08:00
|
|
|
FUNCTION 2 ginarrayextract (anyarray, internal, internal),
|
|
|
|
FUNCTION 3 ginint4_queryextract (internal, internal, int2, internal, internal, internal, internal),
|
|
|
|
FUNCTION 4 ginint4_consistent (internal, int2, internal, int4, internal, internal, internal, internal),
|
2006-05-04 00:31:07 +08:00
|
|
|
STORAGE int4;
|