1 /* contrib/hstore/hstore--1.3.sql */
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION hstore" to load this file. \quit
8 CREATE FUNCTION hstore_in(cstring)
11 LANGUAGE C STRICT IMMUTABLE;
13 CREATE FUNCTION hstore_out(hstore)
16 LANGUAGE C STRICT IMMUTABLE;
18 CREATE FUNCTION hstore_recv(internal)
21 LANGUAGE C STRICT IMMUTABLE;
23 CREATE FUNCTION hstore_send(hstore)
26 LANGUAGE C STRICT IMMUTABLE;
32 RECEIVE = hstore_recv,
37 CREATE FUNCTION hstore_version_diag(hstore)
39 AS 'MODULE_PATHNAME','hstore_version_diag'
40 LANGUAGE C STRICT IMMUTABLE;
42 CREATE FUNCTION fetchval(hstore,text)
44 AS 'MODULE_PATHNAME','hstore_fetchval'
45 LANGUAGE C STRICT IMMUTABLE;
53 CREATE FUNCTION fetchval_numeric(hstore,text)
55 AS 'MODULE_PATHNAME','hstore_fetchval_numeric'
56 LANGUAGE C STRICT IMMUTABLE;
61 PROCEDURE = fetchval_numeric
64 CREATE FUNCTION fetchval_boolean(hstore,text)
66 AS 'MODULE_PATHNAME','hstore_fetchval_boolean'
67 LANGUAGE C STRICT IMMUTABLE;
72 PROCEDURE = fetchval_boolean
75 CREATE FUNCTION fetchval(hstore,int)
77 AS 'MODULE_PATHNAME','hstore_fetchval_n'
78 LANGUAGE C STRICT IMMUTABLE;
86 CREATE FUNCTION fetchval_numeric(hstore,int)
88 AS 'MODULE_PATHNAME','hstore_fetchval_n_numeric'
89 LANGUAGE C STRICT IMMUTABLE;
94 PROCEDURE = fetchval_numeric
97 CREATE FUNCTION fetchval_boolean(hstore,int)
99 AS 'MODULE_PATHNAME','hstore_fetchval_n_boolean'
100 LANGUAGE C STRICT IMMUTABLE;
105 PROCEDURE = fetchval_boolean
108 CREATE FUNCTION fetchval(hstore,text[])
110 AS 'MODULE_PATHNAME','hstore_fetchval_path'
111 LANGUAGE C STRICT IMMUTABLE;
119 CREATE FUNCTION fetchval_numeric(hstore,text[])
121 AS 'MODULE_PATHNAME','hstore_fetchval_path_numeric'
122 LANGUAGE C STRICT IMMUTABLE;
124 CREATE OPERATOR #^> (
127 PROCEDURE = fetchval_numeric
130 CREATE FUNCTION fetchval_boolean(hstore,text[])
132 AS 'MODULE_PATHNAME','hstore_fetchval_path_boolean'
133 LANGUAGE C STRICT IMMUTABLE;
135 CREATE OPERATOR #?> (
138 PROCEDURE = fetchval_boolean
141 CREATE FUNCTION fetchval_hstore(hstore,text)
143 AS 'MODULE_PATHNAME','hstore_fetchval_hstore'
144 LANGUAGE C STRICT IMMUTABLE;
149 PROCEDURE = fetchval_hstore
152 CREATE FUNCTION fetchval_hstore(hstore,int)
154 AS 'MODULE_PATHNAME','hstore_fetchval_n_hstore'
155 LANGUAGE C STRICT IMMUTABLE;
160 PROCEDURE = fetchval_hstore
163 CREATE FUNCTION fetchval_hstore(hstore,text[])
165 AS 'MODULE_PATHNAME','hstore_fetchval_path_hstore'
166 LANGUAGE C STRICT IMMUTABLE;
168 CREATE OPERATOR #%> (
171 PROCEDURE = fetchval_hstore
174 CREATE FUNCTION slice_array(hstore,text[])
176 AS 'MODULE_PATHNAME','hstore_slice_to_array'
177 LANGUAGE C STRICT IMMUTABLE;
182 PROCEDURE = slice_array
185 CREATE FUNCTION slice(hstore,text[])
187 AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
188 LANGUAGE C STRICT IMMUTABLE;
190 CREATE FUNCTION isexists(hstore,text)
192 AS 'MODULE_PATHNAME','hstore_exists'
193 LANGUAGE C STRICT IMMUTABLE;
195 CREATE FUNCTION exist(hstore,text)
197 AS 'MODULE_PATHNAME','hstore_exists'
198 LANGUAGE C STRICT IMMUTABLE;
208 CREATE FUNCTION isexists(hstore,int)
210 AS 'MODULE_PATHNAME','hstore_exists_idx'
211 LANGUAGE C STRICT IMMUTABLE;
213 CREATE FUNCTION exist(hstore,int)
215 AS 'MODULE_PATHNAME','hstore_exists_idx'
216 LANGUAGE C STRICT IMMUTABLE;
226 CREATE FUNCTION isexists(hstore,text[])
228 AS 'MODULE_PATHNAME','hstore_exists_path'
229 LANGUAGE C STRICT IMMUTABLE;
231 CREATE FUNCTION exist(hstore,text[])
233 AS 'MODULE_PATHNAME','hstore_exists_path'
234 LANGUAGE C STRICT IMMUTABLE;
244 CREATE FUNCTION exists_any(hstore,text[])
246 AS 'MODULE_PATHNAME','hstore_exists_any'
247 LANGUAGE C STRICT IMMUTABLE;
252 PROCEDURE = exists_any,
257 CREATE FUNCTION exists_all(hstore,text[])
259 AS 'MODULE_PATHNAME','hstore_exists_all'
260 LANGUAGE C STRICT IMMUTABLE;
265 PROCEDURE = exists_all,
270 CREATE FUNCTION isdefined(hstore,text)
272 AS 'MODULE_PATHNAME','hstore_defined'
273 LANGUAGE C STRICT IMMUTABLE;
275 CREATE FUNCTION defined(hstore,text)
277 AS 'MODULE_PATHNAME','hstore_defined'
278 LANGUAGE C STRICT IMMUTABLE;
280 CREATE FUNCTION delete(hstore,text)
282 AS 'MODULE_PATHNAME','hstore_delete'
283 LANGUAGE C STRICT IMMUTABLE;
285 CREATE FUNCTION delete(hstore,int)
287 AS 'MODULE_PATHNAME','hstore_delete_idx'
288 LANGUAGE C STRICT IMMUTABLE;
290 CREATE FUNCTION delete(hstore,text[])
292 AS 'MODULE_PATHNAME','hstore_delete_array'
293 LANGUAGE C STRICT IMMUTABLE;
295 CREATE FUNCTION delete(hstore,hstore)
297 AS 'MODULE_PATHNAME','hstore_delete_hstore'
298 LANGUAGE C STRICT IMMUTABLE;
300 CREATE FUNCTION delete_path(hstore,text[])
302 AS 'MODULE_PATHNAME','hstore_delete_path'
303 LANGUAGE C STRICT IMMUTABLE;
332 PROCEDURE = delete_path
335 CREATE FUNCTION replace(hstore,text[],hstore)
337 AS 'MODULE_PATHNAME','hstore_replace'
338 LANGUAGE C STRICT IMMUTABLE;
340 CREATE FUNCTION hs_concat(hstore,hstore)
342 AS 'MODULE_PATHNAME','hstore_concat'
343 LANGUAGE C STRICT IMMUTABLE;
348 PROCEDURE = hs_concat
351 CREATE FUNCTION concat_path(hstore,text[],hstore)
353 AS 'MODULE_PATHNAME','hstore_deep_concat'
354 LANGUAGE C STRICT IMMUTABLE;
356 CREATE FUNCTION hs_contains(hstore,hstore)
358 AS 'MODULE_PATHNAME','hstore_contains'
359 LANGUAGE C STRICT IMMUTABLE;
361 CREATE FUNCTION hs_contained(hstore,hstore)
363 AS 'MODULE_PATHNAME','hstore_contained'
364 LANGUAGE C STRICT IMMUTABLE;
369 PROCEDURE = hs_contains,
378 PROCEDURE = hs_contained,
388 PROCEDURE = hs_contains,
397 PROCEDURE = hs_contained,
403 CREATE FUNCTION tconvert(text,text)
405 AS 'MODULE_PATHNAME','hstore_from_text'
406 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
408 CREATE FUNCTION hstore(text,text)
410 AS 'MODULE_PATHNAME','hstore_from_text'
411 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
413 CREATE FUNCTION hstore(text,bool)
415 AS 'MODULE_PATHNAME','hstore_from_bool'
416 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
418 CREATE FUNCTION hstore(text,numeric)
420 AS 'MODULE_PATHNAME','hstore_from_numeric'
421 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
423 CREATE FUNCTION hstore(text,hstore)
425 AS 'MODULE_PATHNAME','hstore_from_th'
426 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
428 CREATE FUNCTION hstore(text)
430 AS 'MODULE_PATHNAME','hstore_scalar_from_text'
431 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
433 CREATE FUNCTION hstore(bool)
435 AS 'MODULE_PATHNAME','hstore_scalar_from_bool'
436 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
438 CREATE FUNCTION hstore(numeric)
440 AS 'MODULE_PATHNAME','hstore_scalar_from_numeric'
441 LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
443 CREATE FUNCTION hstore(text[],text[])
445 AS 'MODULE_PATHNAME', 'hstore_from_arrays'
446 LANGUAGE C IMMUTABLE; -- not STRICT; allows (keys,null)
448 CREATE FUNCTION hstore(text[])
450 AS 'MODULE_PATHNAME', 'hstore_from_array'
451 LANGUAGE C IMMUTABLE STRICT;
453 CREATE CAST (text[] AS hstore)
454 WITH FUNCTION hstore(text[]);
456 CREATE FUNCTION hstore_to_json(hstore)
458 AS 'MODULE_PATHNAME', 'hstore_to_json'
459 LANGUAGE C IMMUTABLE STRICT;
461 CREATE CAST (hstore AS json)
462 WITH FUNCTION hstore_to_json(hstore);
464 CREATE FUNCTION hstore_to_json_loose(hstore)
466 AS 'MODULE_PATHNAME', 'hstore_to_json_loose'
467 LANGUAGE C IMMUTABLE STRICT;
469 CREATE FUNCTION hstore(record)
471 AS 'MODULE_PATHNAME', 'hstore_from_record'
472 LANGUAGE C IMMUTABLE; -- not STRICT; allows (null::recordtype)
474 CREATE FUNCTION hstore_to_array(hstore)
476 AS 'MODULE_PATHNAME','hstore_to_array'
477 LANGUAGE C STRICT IMMUTABLE;
481 PROCEDURE = hstore_to_array
484 CREATE FUNCTION hstore_to_matrix(hstore)
486 AS 'MODULE_PATHNAME','hstore_to_matrix'
487 LANGUAGE C STRICT IMMUTABLE;
491 PROCEDURE = hstore_to_matrix
494 CREATE FUNCTION akeys(hstore)
496 AS 'MODULE_PATHNAME','hstore_akeys'
497 LANGUAGE C STRICT IMMUTABLE;
499 CREATE FUNCTION avals(hstore)
501 AS 'MODULE_PATHNAME','hstore_avals'
502 LANGUAGE C STRICT IMMUTABLE;
504 CREATE FUNCTION skeys(hstore)
506 AS 'MODULE_PATHNAME','hstore_skeys'
507 LANGUAGE C STRICT IMMUTABLE;
509 CREATE FUNCTION svals(hstore)
511 AS 'MODULE_PATHNAME','hstore_svals'
512 LANGUAGE C STRICT IMMUTABLE;
514 CREATE FUNCTION svals(hstore, text[])
516 AS 'MODULE_PATHNAME','hstore_svals_path'
517 LANGUAGE C STRICT IMMUTABLE;
519 CREATE FUNCTION hvals(hstore)
521 AS 'MODULE_PATHNAME','hstore_hvals'
522 LANGUAGE C STRICT IMMUTABLE;
524 CREATE FUNCTION hvals(hstore, text[])
526 AS 'MODULE_PATHNAME','hstore_hvals_path'
527 LANGUAGE C STRICT IMMUTABLE;
529 CREATE FUNCTION each(IN hs hstore,
533 AS 'MODULE_PATHNAME','hstore_each'
534 LANGUAGE C STRICT IMMUTABLE;
536 CREATE FUNCTION each_hstore(IN hs hstore,
540 AS 'MODULE_PATHNAME','hstore_each_hstore'
541 LANGUAGE C STRICT IMMUTABLE;
543 CREATE FUNCTION hstore_typeof(hstore)
545 AS 'MODULE_PATHNAME','hstore_typeof'
546 LANGUAGE C STRICT IMMUTABLE;
548 CREATE FUNCTION populate_record(anyelement,hstore)
550 AS 'MODULE_PATHNAME', 'hstore_populate_record'
551 LANGUAGE C IMMUTABLE; -- not STRICT; allows (null::rectype,hstore)
554 LEFTARG = anyelement,
556 PROCEDURE = populate_record
559 CREATE FUNCTION json_to_hstore(json)
561 AS 'MODULE_PATHNAME','json_to_hstore'
562 LANGUAGE C STRICT IMMUTABLE;
564 CREATE CAST (json AS hstore)
565 WITH FUNCTION json_to_hstore(json);
567 CREATE FUNCTION array_to_hstore(anyarray)
569 AS 'MODULE_PATHNAME','array_to_hstore'
570 LANGUAGE C STRICT IMMUTABLE;
574 CREATE FUNCTION hstore_eq(hstore,hstore)
576 AS 'MODULE_PATHNAME','hstore_eq'
577 LANGUAGE C STRICT IMMUTABLE;
579 CREATE FUNCTION hstore_ne(hstore,hstore)
581 AS 'MODULE_PATHNAME','hstore_ne'
582 LANGUAGE C STRICT IMMUTABLE;
584 CREATE FUNCTION hstore_gt(hstore,hstore)
586 AS 'MODULE_PATHNAME','hstore_gt'
587 LANGUAGE C STRICT IMMUTABLE;
589 CREATE FUNCTION hstore_ge(hstore,hstore)
591 AS 'MODULE_PATHNAME','hstore_ge'
592 LANGUAGE C STRICT IMMUTABLE;
594 CREATE FUNCTION hstore_lt(hstore,hstore)
596 AS 'MODULE_PATHNAME','hstore_lt'
597 LANGUAGE C STRICT IMMUTABLE;
599 CREATE FUNCTION hstore_le(hstore,hstore)
601 AS 'MODULE_PATHNAME','hstore_le'
602 LANGUAGE C STRICT IMMUTABLE;
604 CREATE FUNCTION hstore_cmp(hstore,hstore)
606 AS 'MODULE_PATHNAME','hstore_cmp'
607 LANGUAGE C STRICT IMMUTABLE;
612 PROCEDURE = hstore_eq,
623 PROCEDURE = hstore_ne,
630 -- the comparison operators have funky names (and are undocumented)
631 -- in an attempt to discourage anyone from actually using them. they
632 -- only exist to support the btree opclass
634 CREATE OPERATOR #<# (
637 PROCEDURE = hstore_lt,
640 RESTRICT = scalarltsel,
641 JOIN = scalarltjoinsel
643 CREATE OPERATOR #<=# (
646 PROCEDURE = hstore_le,
649 RESTRICT = scalarltsel,
650 JOIN = scalarltjoinsel
652 CREATE OPERATOR #># (
655 PROCEDURE = hstore_gt,
658 RESTRICT = scalargtsel,
659 JOIN = scalargtjoinsel
661 CREATE OPERATOR #>=# (
664 PROCEDURE = hstore_ge,
667 RESTRICT = scalargtsel,
668 JOIN = scalargtjoinsel
671 CREATE OPERATOR CLASS btree_hstore_ops
672 DEFAULT FOR TYPE hstore USING btree
679 FUNCTION 1 hstore_cmp(hstore,hstore);
683 CREATE FUNCTION hstore_hash(hstore)
685 AS 'MODULE_PATHNAME','hstore_hash'
686 LANGUAGE C STRICT IMMUTABLE;
688 CREATE OPERATOR CLASS hash_hstore_ops
689 DEFAULT FOR TYPE hstore USING hash
692 FUNCTION 1 hstore_hash(hstore);
698 CREATE FUNCTION ghstore_in(cstring)
701 LANGUAGE C STRICT IMMUTABLE;
703 CREATE FUNCTION ghstore_out(ghstore)
706 LANGUAGE C STRICT IMMUTABLE;
708 CREATE TYPE ghstore (
714 CREATE FUNCTION ghstore_compress(internal)
717 LANGUAGE C IMMUTABLE STRICT;
719 CREATE FUNCTION ghstore_decompress(internal)
722 LANGUAGE C IMMUTABLE STRICT;
724 CREATE FUNCTION ghstore_penalty(internal,internal,internal)
727 LANGUAGE C IMMUTABLE STRICT;
729 CREATE FUNCTION ghstore_picksplit(internal, internal)
732 LANGUAGE C IMMUTABLE STRICT;
734 CREATE FUNCTION ghstore_union(internal, internal)
737 LANGUAGE C IMMUTABLE STRICT;
739 CREATE FUNCTION ghstore_same(internal, internal, internal)
742 LANGUAGE C IMMUTABLE STRICT;
744 CREATE FUNCTION ghstore_consistent(internal,internal,int,oid,internal)
747 LANGUAGE C IMMUTABLE STRICT;
749 CREATE OPERATOR CLASS gist_hstore_ops
750 DEFAULT FOR TYPE hstore USING gist
753 OPERATOR 9 ?(hstore,text) ,
754 OPERATOR 10 ?|(hstore,text[]) ,
755 OPERATOR 11 ?&(hstore,text[]) ,
759 FUNCTION 1 ghstore_consistent (internal, internal, int, oid, internal),
760 FUNCTION 2 ghstore_union (internal, internal),
761 FUNCTION 3 ghstore_compress (internal),
762 FUNCTION 4 ghstore_decompress (internal),
763 FUNCTION 5 ghstore_penalty (internal, internal, internal),
764 FUNCTION 6 ghstore_picksplit (internal, internal),
765 FUNCTION 7 ghstore_same (internal, internal, internal),
768 -- GIN support: default opclass
770 CREATE FUNCTION gin_extract_hstore(internal, internal)
773 LANGUAGE C IMMUTABLE STRICT;
775 CREATE FUNCTION gin_extract_hstore_query(internal, internal, int2, internal, internal)
778 LANGUAGE C IMMUTABLE STRICT;
780 CREATE FUNCTION gin_consistent_hstore(internal, int2, internal, int4, internal, internal)
783 LANGUAGE C IMMUTABLE STRICT;
785 CREATE OPERATOR CLASS gin_hstore_ops
786 DEFAULT FOR TYPE hstore USING gin
789 OPERATOR 9 ?(hstore,text),
790 OPERATOR 10 ?|(hstore,text[]),
791 OPERATOR 11 ?&(hstore,text[]),
792 FUNCTION 1 bttextcmp(text,text),
793 FUNCTION 2 gin_extract_hstore(internal, internal),
794 FUNCTION 3 gin_extract_hstore_query(internal, internal, int2, internal, internal),
795 FUNCTION 4 gin_consistent_hstore(internal, int2, internal, int4, internal, internal),
798 -- GIN support: hash based opclass
800 CREATE FUNCTION gin_extract_hstore_hash(internal, internal)
803 LANGUAGE C IMMUTABLE STRICT;
805 CREATE FUNCTION gin_extract_hstore_hash_query(internal, internal, int2, internal, internal)
808 LANGUAGE C IMMUTABLE STRICT;
810 CREATE FUNCTION gin_consistent_hstore_hash(internal, int2, internal, int4, internal, internal)
813 LANGUAGE C IMMUTABLE STRICT;
815 CREATE OPERATOR CLASS gin_hstore_hash_ops
816 FOR TYPE hstore USING gin
819 FUNCTION 1 btint4cmp(int4,int4),
820 FUNCTION 2 gin_extract_hstore_hash(internal, internal),
821 FUNCTION 3 gin_extract_hstore_hash_query(internal, internal, int2, internal, internal),
822 FUNCTION 4 gin_consistent_hstore_hash(internal, int2, internal, int4, internal, internal),
827 CREATE FUNCTION hstore_print(hstore,
828 pretty_print bool DEFAULT false,
829 array_curly_braces bool DEFAULT false,
830 root_hash_decorated bool DEFAULT false,
831 json bool DEFAULT false,
832 loose bool DEFAULT false)
834 AS 'MODULE_PATHNAME', 'hstore_print'
835 LANGUAGE C IMMUTABLE STRICT;