2011-02-14 09:06:41 +08:00
|
|
|
/* contrib/ltree/ltree--1.0.sql */
|
2002-07-31 02:48:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_in(cstring)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS ltree
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_out(ltree)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS cstring
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE TYPE ltree (
|
2002-10-19 02:41:22 +08:00
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = ltree_in,
|
|
|
|
OUTPUT = ltree_out,
|
|
|
|
STORAGE = extended
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--Compare function for ltree
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_cmp(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_lt(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_le(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_eq(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_ge(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_gt(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_ne(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
CREATE OPERATOR < (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_lt,
|
|
|
|
COMMUTATOR = '>',
|
|
|
|
NEGATOR = '>=',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR <= (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_le,
|
|
|
|
COMMUTATOR = '>=',
|
|
|
|
NEGATOR = '>',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR >= (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_ge,
|
|
|
|
COMMUTATOR = '<=',
|
|
|
|
NEGATOR = '<',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR > (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_gt,
|
|
|
|
COMMUTATOR = '<',
|
|
|
|
NEGATOR = '<=',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR = (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_eq,
|
|
|
|
COMMUTATOR = '=',
|
|
|
|
NEGATOR = '<>',
|
|
|
|
RESTRICT = eqsel,
|
|
|
|
JOIN = eqjoinsel,
|
|
|
|
SORT1 = '<',
|
|
|
|
SORT2 = '<'
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR <> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_ne,
|
|
|
|
COMMUTATOR = '<>',
|
|
|
|
NEGATOR = '=',
|
|
|
|
RESTRICT = neqsel,
|
|
|
|
JOIN = neqjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--util functions
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION subltree(ltree,int4,int4)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION subpath(ltree,int4,int4)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION subpath(ltree,int4)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION index(ltree,ltree)
|
2003-04-01 04:53:45 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME', 'ltree_index'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-04-01 04:53:45 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION index(ltree,ltree,int4)
|
2003-04-01 04:53:45 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME', 'ltree_index'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-04-01 04:53:45 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION nlevel(ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree2text(ltree)
|
2003-04-01 04:53:45 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-04-01 04:53:45 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION text2ltree(text)
|
2003-04-01 04:53:45 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-04-01 04:53:45 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(_ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME','_lca'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree,ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree,ltree)
|
2002-08-04 13:02:50 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-08-04 13:02:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_isparent(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_risparent(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_addltree(ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_addtext(ltree,text)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_textadd(text,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltreeparentsel(internal, oid, internal, integer)
|
2006-04-27 06:33:36 +08:00
|
|
|
RETURNS float8
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2006-04-27 06:33:36 +08:00
|
|
|
|
2002-07-31 00:40:34 +08:00
|
|
|
CREATE OPERATOR @> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_isparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '<@',
|
2006-04-27 08:58:20 +08:00
|
|
|
RESTRICT = ltreeparentsel,
|
2002-10-19 02:41:22 +08:00
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^@> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_isparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^<@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR <@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_risparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@>',
|
2006-04-27 08:58:20 +08:00
|
|
|
RESTRICT = ltreeparentsel,
|
2002-10-19 02:41:22 +08:00
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^<@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_risparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@>',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR || (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_addltree
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR || (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = text,
|
|
|
|
PROCEDURE = ltree_addtext
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR || (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = text,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltree_textadd
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
-- B-tree support
|
2002-07-31 02:48:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR CLASS ltree_ops
|
|
|
|
DEFAULT FOR TYPE ltree USING btree AS
|
|
|
|
OPERATOR 1 < ,
|
|
|
|
OPERATOR 2 <= ,
|
|
|
|
OPERATOR 3 = ,
|
|
|
|
OPERATOR 4 >= ,
|
|
|
|
OPERATOR 5 > ,
|
|
|
|
FUNCTION 1 ltree_cmp(ltree, ltree);
|
|
|
|
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
--lquery type
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lquery_in(cstring)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS lquery
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lquery_out(lquery)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS cstring
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE TYPE lquery (
|
2002-10-19 02:41:22 +08:00
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = lquery_in,
|
|
|
|
OUTPUT = lquery_out,
|
|
|
|
STORAGE = extended
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltq_regex(ltree,lquery)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltq_rregex(lquery,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = lquery,
|
|
|
|
PROCEDURE = ltq_regex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = lquery,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltq_rregex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--not-indexed
|
|
|
|
CREATE OPERATOR ^~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = lquery,
|
|
|
|
PROCEDURE = ltq_regex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = lquery,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltq_rregex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lt_q_regex(ltree,_lquery)
|
2003-02-19 11:50:09 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-02-19 11:50:09 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION lt_q_rregex(_lquery,ltree)
|
2003-02-19 11:50:09 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-02-19 11:50:09 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ? (
|
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = _lquery,
|
|
|
|
PROCEDURE = lt_q_regex,
|
|
|
|
COMMUTATOR = '?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ? (
|
|
|
|
LEFTARG = _lquery,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = lt_q_rregex,
|
|
|
|
COMMUTATOR = '?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
--not-indexed
|
|
|
|
CREATE OPERATOR ^? (
|
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = _lquery,
|
|
|
|
PROCEDURE = lt_q_regex,
|
|
|
|
COMMUTATOR = '^?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^? (
|
|
|
|
LEFTARG = _lquery,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = lt_q_rregex,
|
|
|
|
COMMUTATOR = '^?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltxtq_in(cstring)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS ltxtquery
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltxtq_out(ltxtquery)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS cstring
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE TYPE ltxtquery (
|
2002-10-19 02:41:22 +08:00
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = ltxtq_in,
|
|
|
|
OUTPUT = ltxtq_out,
|
|
|
|
STORAGE = extended
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
-- operations WITH ltxtquery
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltxtq_exec(ltree, ltxtquery)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltxtq_rexec(ltxtquery, ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR @ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltxtquery,
|
|
|
|
PROCEDURE = ltxtq_exec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR @ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltxtquery,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltxtq_rexec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--not-indexed
|
|
|
|
CREATE OPERATOR ^@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = ltxtquery,
|
|
|
|
PROCEDURE = ltxtq_exec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltxtquery,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = ltxtq_rexec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--GiST support for ltree
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_gist_in(cstring)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS ltree_gist
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2010-11-24 04:27:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_gist_out(ltree_gist)
|
2002-08-22 08:01:51 +08:00
|
|
|
RETURNS cstring
|
2002-07-31 00:40:34 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT;
|
2010-11-24 04:27:50 +08:00
|
|
|
|
2002-07-31 00:40:34 +08:00
|
|
|
CREATE TYPE ltree_gist (
|
|
|
|
internallength = -1,
|
|
|
|
input = ltree_gist_in,
|
|
|
|
output = ltree_gist_out,
|
|
|
|
storage = plain
|
2010-11-24 04:27:50 +08:00
|
|
|
);
|
2002-10-19 02:41:22 +08:00
|
|
|
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_consistent(internal,internal,int2,oid,internal)
|
2009-06-12 02:30:03 +08:00
|
|
|
RETURNS bool as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_compress(internal)
|
2009-06-12 02:30:03 +08:00
|
|
|
RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_decompress(internal)
|
2009-06-12 02:30:03 +08:00
|
|
|
RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_penalty(internal,internal,internal)
|
2007-09-30 08:03:47 +08:00
|
|
|
RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_picksplit(internal, internal)
|
2009-06-12 02:30:03 +08:00
|
|
|
RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_union(internal, internal)
|
2009-06-12 02:30:03 +08:00
|
|
|
RETURNS int4 as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION ltree_same(internal, internal, internal)
|
2009-06-12 02:30:03 +08:00
|
|
|
RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2002-07-31 02:48:34 +08:00
|
|
|
CREATE OPERATOR CLASS gist_ltree_ops
|
|
|
|
DEFAULT FOR TYPE ltree USING gist AS
|
|
|
|
OPERATOR 1 < ,
|
|
|
|
OPERATOR 2 <= ,
|
|
|
|
OPERATOR 3 = ,
|
|
|
|
OPERATOR 4 >= ,
|
|
|
|
OPERATOR 5 > ,
|
|
|
|
OPERATOR 10 @> ,
|
|
|
|
OPERATOR 11 <@ ,
|
|
|
|
OPERATOR 12 ~ (ltree, lquery) ,
|
|
|
|
OPERATOR 13 ~ (lquery, ltree) ,
|
|
|
|
OPERATOR 14 @ (ltree, ltxtquery) ,
|
|
|
|
OPERATOR 15 @ (ltxtquery, ltree) ,
|
2003-02-19 11:50:09 +08:00
|
|
|
OPERATOR 16 ? (ltree, _lquery) ,
|
|
|
|
OPERATOR 17 ? (_lquery, ltree) ,
|
2008-04-15 01:05:34 +08:00
|
|
|
FUNCTION 1 ltree_consistent (internal, internal, int2, oid, internal),
|
2004-03-30 23:45:33 +08:00
|
|
|
FUNCTION 2 ltree_union (internal, internal),
|
2002-08-22 08:01:51 +08:00
|
|
|
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),
|
2002-07-31 02:48:34 +08:00
|
|
|
STORAGE ltree_gist;
|
|
|
|
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
-- arrays of ltree
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_isparent(_ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_r_isparent(ltree,_ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_risparent(_ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_r_risparent(ltree,_ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltq_regex(_ltree,lquery)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltq_rregex(lquery,_ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _lt_q_regex(_ltree,_lquery)
|
2003-02-19 11:50:09 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-02-19 11:50:09 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _lt_q_rregex(_lquery,_ltree)
|
2003-02-19 11:50:09 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2003-02-19 11:50:09 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltxtq_exec(_ltree, ltxtquery)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltxtq_rexec(ltxtquery, _ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR @> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = _ltree_isparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '<@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR <@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltree_r_isparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@>',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR <@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = _ltree_risparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@>',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR @> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltree_r_risparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '<@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = lquery,
|
|
|
|
PROCEDURE = _ltq_regex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = lquery,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltq_rregex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2003-02-19 11:50:09 +08:00
|
|
|
CREATE OPERATOR ? (
|
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = _lquery,
|
|
|
|
PROCEDURE = _lt_q_regex,
|
|
|
|
COMMUTATOR = '?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ? (
|
|
|
|
LEFTARG = _lquery,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _lt_q_rregex,
|
|
|
|
COMMUTATOR = '?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
2002-07-31 00:40:34 +08:00
|
|
|
CREATE OPERATOR @ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltxtquery,
|
|
|
|
PROCEDURE = _ltxtq_exec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR @ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltxtquery,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltxtq_rexec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
--not indexed
|
|
|
|
CREATE OPERATOR ^@> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = _ltree_isparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^<@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^<@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltree_r_isparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@>',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^<@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = _ltree_risparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@>',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^@> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltree,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltree_r_risparent,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^<@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = lquery,
|
|
|
|
PROCEDURE = _ltq_regex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = lquery,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltq_rregex,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^~',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2003-02-19 11:50:09 +08:00
|
|
|
CREATE OPERATOR ^? (
|
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = _lquery,
|
|
|
|
PROCEDURE = _lt_q_regex,
|
|
|
|
COMMUTATOR = '^?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^? (
|
|
|
|
LEFTARG = _lquery,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _lt_q_rregex,
|
|
|
|
COMMUTATOR = '^?',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
2002-07-31 00:40:34 +08:00
|
|
|
CREATE OPERATOR ^@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltxtquery,
|
|
|
|
PROCEDURE = _ltxtq_exec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ^@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = ltxtquery,
|
|
|
|
RIGHTARG = _ltree,
|
|
|
|
PROCEDURE = _ltxtq_rexec,
|
2002-07-31 00:40:34 +08:00
|
|
|
COMMUTATOR = '^@',
|
2002-10-19 02:41:22 +08:00
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--extractors
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_extract_isparent(_ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ?@> (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = _ltree_extract_isparent
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_extract_risparent(_ltree,ltree)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ?<@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltree,
|
|
|
|
PROCEDURE = _ltree_extract_risparent
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltq_extract_regex(_ltree,lquery)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ?~ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = lquery,
|
|
|
|
PROCEDURE = _ltq_extract_regex
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltxtq_extract_exec(_ltree,ltxtquery)
|
2002-07-31 00:40:34 +08:00
|
|
|
RETURNS ltree
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ?@ (
|
2002-10-19 02:41:22 +08:00
|
|
|
LEFTARG = _ltree,
|
|
|
|
RIGHTARG = ltxtquery,
|
|
|
|
PROCEDURE = _ltxtq_extract_exec
|
2002-07-31 00:40:34 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
--GiST support for ltree[]
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_consistent(internal,internal,int2,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;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_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;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_penalty(internal,internal,internal)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2007-09-30 08:03:47 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_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;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_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;
|
2006-02-28 00:09:50 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION _ltree_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;
|
2002-07-31 00:40:34 +08:00
|
|
|
|
2002-07-31 02:48:34 +08:00
|
|
|
CREATE OPERATOR CLASS gist__ltree_ops
|
|
|
|
DEFAULT FOR TYPE _ltree USING gist AS
|
2008-04-15 01:05:34 +08:00
|
|
|
OPERATOR 10 <@ (_ltree, ltree),
|
|
|
|
OPERATOR 11 @> (ltree, _ltree),
|
|
|
|
OPERATOR 12 ~ (_ltree, lquery),
|
|
|
|
OPERATOR 13 ~ (lquery, _ltree),
|
|
|
|
OPERATOR 14 @ (_ltree, ltxtquery),
|
|
|
|
OPERATOR 15 @ (ltxtquery, _ltree),
|
|
|
|
OPERATOR 16 ? (_ltree, _lquery),
|
|
|
|
OPERATOR 17 ? (_lquery, _ltree),
|
|
|
|
FUNCTION 1 _ltree_consistent (internal, internal, int2, oid, internal),
|
2004-03-30 23:45:33 +08:00
|
|
|
FUNCTION 2 _ltree_union (internal, internal),
|
2002-08-22 08:01:51 +08:00
|
|
|
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),
|
2002-07-31 02:48:34 +08:00
|
|
|
STORAGE ltree_gist;
|