3 -- Adjust this setting to control where the objects get created.
4 SET search_path
= public;
6 CREATE OR REPLACE FUNCTION ltree_in(cstring
)
11 CREATE OR REPLACE FUNCTION ltree_out(ltree
)
24 --Compare function for ltree
25 CREATE OR REPLACE FUNCTION ltree_cmp(ltree
,ltree
)
28 LANGUAGE C
STRICT IMMUTABLE;
30 CREATE OR REPLACE FUNCTION ltree_lt(ltree
,ltree
)
33 LANGUAGE C
STRICT IMMUTABLE;
35 CREATE OR REPLACE FUNCTION ltree_le(ltree
,ltree
)
38 LANGUAGE C
STRICT IMMUTABLE;
40 CREATE OR REPLACE FUNCTION ltree_eq(ltree
,ltree
)
43 LANGUAGE C
STRICT IMMUTABLE;
45 CREATE OR REPLACE FUNCTION ltree_ge(ltree
,ltree
)
48 LANGUAGE C
STRICT IMMUTABLE;
50 CREATE OR REPLACE FUNCTION ltree_gt(ltree
,ltree
)
53 LANGUAGE C
STRICT IMMUTABLE;
55 CREATE OR REPLACE FUNCTION ltree_ne(ltree
,ltree
)
58 LANGUAGE C
STRICT IMMUTABLE;
104 PROCEDURE = ltree_eq
,
116 PROCEDURE = ltree_ne
,
125 CREATE OR REPLACE FUNCTION subltree(ltree
,int4
,int4
)
128 LANGUAGE C
STRICT IMMUTABLE;
130 CREATE OR REPLACE FUNCTION subpath(ltree
,int4
,int4
)
133 LANGUAGE C
STRICT IMMUTABLE;
135 CREATE OR REPLACE FUNCTION subpath(ltree
,int4
)
138 LANGUAGE C
STRICT IMMUTABLE;
140 CREATE OR REPLACE FUNCTION index(ltree
,ltree
)
142 AS 'MODULE_PATHNAME', 'ltree_index'
143 LANGUAGE C
STRICT IMMUTABLE;
145 CREATE OR REPLACE FUNCTION index(ltree
,ltree
,int4
)
147 AS 'MODULE_PATHNAME', 'ltree_index'
148 LANGUAGE C
STRICT IMMUTABLE;
150 CREATE OR REPLACE FUNCTION nlevel(ltree
)
153 LANGUAGE C
STRICT IMMUTABLE;
155 CREATE OR REPLACE FUNCTION ltree2text(ltree
)
158 LANGUAGE C
STRICT IMMUTABLE;
160 CREATE OR REPLACE FUNCTION text2ltree(text)
163 LANGUAGE C
STRICT IMMUTABLE;
165 CREATE OR REPLACE FUNCTION lca(_ltree
)
167 AS 'MODULE_PATHNAME','_lca'
168 LANGUAGE C
STRICT IMMUTABLE;
170 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
)
173 LANGUAGE C
STRICT IMMUTABLE;
175 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
,ltree
)
178 LANGUAGE C
STRICT IMMUTABLE;
180 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
,ltree
,ltree
)
183 LANGUAGE C
STRICT IMMUTABLE;
185 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
,ltree
,ltree
,ltree
)
188 LANGUAGE C
STRICT IMMUTABLE;
190 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
,ltree
,ltree
,ltree
,ltree
)
193 LANGUAGE C
STRICT IMMUTABLE;
195 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
,ltree
,ltree
,ltree
,ltree
,ltree
)
198 LANGUAGE C
STRICT IMMUTABLE;
200 CREATE OR REPLACE FUNCTION lca(ltree
,ltree
,ltree
,ltree
,ltree
,ltree
,ltree
,ltree
)
203 LANGUAGE C
STRICT IMMUTABLE;
205 CREATE OR REPLACE FUNCTION ltree_isparent(ltree
,ltree
)
208 LANGUAGE C
STRICT IMMUTABLE;
210 CREATE OR REPLACE FUNCTION ltree_risparent(ltree
,ltree
)
213 LANGUAGE C
STRICT IMMUTABLE;
215 CREATE OR REPLACE FUNCTION ltree_addltree(ltree
,ltree
)
218 LANGUAGE C
STRICT IMMUTABLE;
220 CREATE OR REPLACE FUNCTION ltree_addtext(ltree
,text)
223 LANGUAGE C
STRICT IMMUTABLE;
225 CREATE OR REPLACE FUNCTION ltree_textadd(text,ltree
)
228 LANGUAGE C
STRICT IMMUTABLE;
230 CREATE OR REPLACE FUNCTION ltreeparentsel(internal
, oid
, internal
, integer)
233 LANGUAGE C
STRICT IMMUTABLE;
238 PROCEDURE = ltree_isparent
,
240 RESTRICT = ltreeparentsel
,
244 CREATE OPERATOR ^@
> (
247 PROCEDURE = ltree_isparent
,
256 PROCEDURE = ltree_risparent
,
258 RESTRICT = ltreeparentsel
,
262 CREATE OPERATOR ^
<@
(
265 PROCEDURE = ltree_risparent
,
274 PROCEDURE = ltree_addltree
280 PROCEDURE = ltree_addtext
286 PROCEDURE = ltree_textadd
292 CREATE OPERATOR CLASS ltree_ops
293 DEFAULT FOR TYPE ltree
USING btree
AS
299 FUNCTION 1 ltree_cmp(ltree
, ltree
);
303 CREATE OR REPLACE FUNCTION lquery_in(cstring
)
308 CREATE OR REPLACE FUNCTION lquery_out(lquery
)
320 CREATE OR REPLACE FUNCTION ltq_regex(ltree
,lquery
)
323 LANGUAGE C
STRICT IMMUTABLE;
325 CREATE OR REPLACE FUNCTION ltq_rregex(lquery
,ltree
)
328 LANGUAGE C
STRICT IMMUTABLE;
333 PROCEDURE = ltq_regex
,
342 PROCEDURE = ltq_rregex
,
352 PROCEDURE = ltq_regex
,
361 PROCEDURE = ltq_rregex
,
367 CREATE OR REPLACE FUNCTION lt_q_regex(ltree
,_lquery
)
370 LANGUAGE C
STRICT IMMUTABLE;
372 CREATE OR REPLACE FUNCTION lt_q_rregex(_lquery
,ltree
)
375 LANGUAGE C
STRICT IMMUTABLE;
380 PROCEDURE = lt_q_regex
,
389 PROCEDURE = lt_q_rregex
,
399 PROCEDURE = lt_q_regex
,
408 PROCEDURE = lt_q_rregex
,
414 CREATE OR REPLACE FUNCTION ltxtq_in(cstring
)
419 CREATE OR REPLACE FUNCTION ltxtq_out(ltxtquery
)
424 CREATE TYPE ltxtquery (
431 -- operations WITH ltxtquery
433 CREATE OR REPLACE FUNCTION ltxtq_exec(ltree
, ltxtquery
)
436 LANGUAGE C
STRICT IMMUTABLE;
438 CREATE OR REPLACE FUNCTION ltxtq_rexec(ltxtquery
, ltree
)
441 LANGUAGE C
STRICT IMMUTABLE;
445 RIGHTARG
= ltxtquery
,
446 PROCEDURE = ltxtq_exec
,
455 PROCEDURE = ltxtq_rexec
,
464 RIGHTARG
= ltxtquery
,
465 PROCEDURE = ltxtq_exec
,
474 PROCEDURE = ltxtq_rexec
,
480 --GiST support for ltree
481 CREATE OR REPLACE FUNCTION ltree_gist_in(cstring
)
486 CREATE OR REPLACE FUNCTION ltree_gist_out(ltree_gist
)
491 CREATE TYPE ltree_gist (
493 input = ltree_gist_in
,
494 output = ltree_gist_out
,
499 CREATE OR REPLACE FUNCTION ltree_consistent(internal
,internal
,int2
,oid
,internal
)
500 RETURNS bool
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
502 CREATE OR REPLACE FUNCTION ltree_compress(internal
)
503 RETURNS internal
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
505 CREATE OR REPLACE FUNCTION ltree_decompress(internal
)
506 RETURNS internal
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
508 CREATE OR REPLACE FUNCTION ltree_penalty(internal
,internal
,internal
)
509 RETURNS internal
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
511 CREATE OR REPLACE FUNCTION ltree_picksplit(internal
, internal
)
512 RETURNS internal
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
514 CREATE OR REPLACE FUNCTION ltree_union(internal
, internal
)
515 RETURNS int4
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
517 CREATE OR REPLACE FUNCTION ltree_same(internal
, internal
, internal
)
518 RETURNS internal
as 'MODULE_PATHNAME' LANGUAGE C
IMMUTABLE STRICT;
520 CREATE OPERATOR CLASS gist_ltree_ops
521 DEFAULT FOR TYPE ltree
USING gist
AS
529 OPERATOR 12 ~
(ltree
, lquery
) ,
530 OPERATOR 13 ~
(lquery
, ltree
) ,
531 OPERATOR 14 @
(ltree
, ltxtquery
) ,
532 OPERATOR 15 @
(ltxtquery
, ltree
) ,
533 OPERATOR 16 ?
(ltree
, _lquery
) ,
534 OPERATOR 17 ?
(_lquery
, ltree
) ,
535 FUNCTION 1 ltree_consistent (internal
, internal
, int2
, oid
, internal
),
536 FUNCTION 2 ltree_union (internal
, internal
),
537 FUNCTION 3 ltree_compress (internal
),
538 FUNCTION 4 ltree_decompress (internal
),
539 FUNCTION 5 ltree_penalty (internal
, internal
, internal
),
540 FUNCTION 6 ltree_picksplit (internal
, internal
),
541 FUNCTION 7 ltree_same (internal
, internal
, internal
),
547 CREATE OR REPLACE FUNCTION _ltree_isparent(_ltree
,ltree
)
550 LANGUAGE C
STRICT IMMUTABLE;
552 CREATE OR REPLACE FUNCTION _ltree_r_isparent(ltree
,_ltree
)
555 LANGUAGE C
STRICT IMMUTABLE;
557 CREATE OR REPLACE FUNCTION _ltree_risparent(_ltree
,ltree
)
560 LANGUAGE C
STRICT IMMUTABLE;
562 CREATE OR REPLACE FUNCTION _ltree_r_risparent(ltree
,_ltree
)
565 LANGUAGE C
STRICT IMMUTABLE;
567 CREATE OR REPLACE FUNCTION _ltq_regex(_ltree
,lquery
)
570 LANGUAGE C
STRICT IMMUTABLE;
572 CREATE OR REPLACE FUNCTION _ltq_rregex(lquery
,_ltree
)
575 LANGUAGE C
STRICT IMMUTABLE;
577 CREATE OR REPLACE FUNCTION _lt_q_regex(_ltree
,_lquery
)
580 LANGUAGE C
STRICT IMMUTABLE;
582 CREATE OR REPLACE FUNCTION _lt_q_rregex(_lquery
,_ltree
)
585 LANGUAGE C
STRICT IMMUTABLE;
587 CREATE OR REPLACE FUNCTION _ltxtq_exec(_ltree
, ltxtquery
)
590 LANGUAGE C
STRICT IMMUTABLE;
592 CREATE OR REPLACE FUNCTION _ltxtq_rexec(ltxtquery
, _ltree
)
595 LANGUAGE C
STRICT IMMUTABLE;
600 PROCEDURE = _ltree_isparent
,
609 PROCEDURE = _ltree_r_isparent
,
618 PROCEDURE = _ltree_risparent
,
627 PROCEDURE = _ltree_r_risparent
,
636 PROCEDURE = _ltq_regex
,
645 PROCEDURE = _ltq_rregex
,
654 PROCEDURE = _lt_q_regex
,
663 PROCEDURE = _lt_q_rregex
,
671 RIGHTARG
= ltxtquery
,
672 PROCEDURE = _ltxtq_exec
,
681 PROCEDURE = _ltxtq_rexec
,
689 CREATE OPERATOR ^@
> (
692 PROCEDURE = _ltree_isparent
,
698 CREATE OPERATOR ^
<@
(
701 PROCEDURE = _ltree_r_isparent
,
707 CREATE OPERATOR ^
<@
(
710 PROCEDURE = _ltree_risparent
,
716 CREATE OPERATOR ^@
> (
719 PROCEDURE = _ltree_r_risparent
,
728 PROCEDURE = _ltq_regex
,
737 PROCEDURE = _ltq_rregex
,
746 PROCEDURE = _lt_q_regex
,
755 PROCEDURE = _lt_q_rregex
,
763 RIGHTARG
= ltxtquery
,
764 PROCEDURE = _ltxtq_exec
,
773 PROCEDURE = _ltxtq_rexec
,
780 CREATE OR REPLACE FUNCTION _ltree_extract_isparent(_ltree
,ltree
)
783 LANGUAGE C
STRICT IMMUTABLE;
785 CREATE OPERATOR ?@
> (
788 PROCEDURE = _ltree_extract_isparent
791 CREATE OR REPLACE FUNCTION _ltree_extract_risparent(_ltree
,ltree
)
794 LANGUAGE C
STRICT IMMUTABLE;
796 CREATE OPERATOR ?
<@
(
799 PROCEDURE = _ltree_extract_risparent
802 CREATE OR REPLACE FUNCTION _ltq_extract_regex(_ltree
,lquery
)
805 LANGUAGE C
STRICT IMMUTABLE;
810 PROCEDURE = _ltq_extract_regex
813 CREATE OR REPLACE FUNCTION _ltxtq_extract_exec(_ltree
,ltxtquery
)
816 LANGUAGE C
STRICT IMMUTABLE;
820 RIGHTARG
= ltxtquery
,
821 PROCEDURE = _ltxtq_extract_exec
824 --GiST support for ltree[]
825 CREATE OR REPLACE FUNCTION _ltree_consistent(internal
,internal
,int2
,oid
,internal
)
828 LANGUAGE C
IMMUTABLE STRICT;
830 CREATE OR REPLACE FUNCTION _ltree_compress(internal
)
833 LANGUAGE C
IMMUTABLE STRICT;
835 CREATE OR REPLACE FUNCTION _ltree_penalty(internal
,internal
,internal
)
838 LANGUAGE C
IMMUTABLE STRICT;
840 CREATE OR REPLACE FUNCTION _ltree_picksplit(internal
, internal
)
843 LANGUAGE C
IMMUTABLE STRICT;
845 CREATE OR REPLACE FUNCTION _ltree_union(internal
, internal
)
848 LANGUAGE C
IMMUTABLE STRICT;
850 CREATE OR REPLACE FUNCTION _ltree_same(internal
, internal
, internal
)
853 LANGUAGE C
IMMUTABLE STRICT;
855 CREATE OPERATOR CLASS gist__ltree_ops
856 DEFAULT FOR TYPE _ltree
USING gist
AS
857 OPERATOR 10 <@
(_ltree
, ltree
),
858 OPERATOR 11 @
> (ltree
, _ltree
),
859 OPERATOR 12 ~
(_ltree
, lquery
),
860 OPERATOR 13 ~
(lquery
, _ltree
),
861 OPERATOR 14 @
(_ltree
, ltxtquery
),
862 OPERATOR 15 @
(ltxtquery
, _ltree
),
863 OPERATOR 16 ?
(_ltree
, _lquery
),
864 OPERATOR 17 ?
(_lquery
, _ltree
),
865 FUNCTION 1 _ltree_consistent (internal
, internal
, int2
, oid
, internal
),
866 FUNCTION 2 _ltree_union (internal
, internal
),
867 FUNCTION 3 _ltree_compress (internal
),
868 FUNCTION 4 ltree_decompress (internal
),
869 FUNCTION 5 _ltree_penalty (internal
, internal
, internal
),
870 FUNCTION 6 _ltree_picksplit (internal
, internal
),
871 FUNCTION 7 _ltree_same (internal
, internal
, internal
),