2016-06-10 04:44:25 +08:00
|
|
|
/* contrib/hstore/hstore--1.4.sql */
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
|
|
\echo Use "CREATE EXTENSION hstore" to load this file. \quit
|
|
|
|
|
|
|
|
CREATE TYPE hstore;
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_in(cstring)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_out(hstore)
|
|
|
|
RETURNS cstring
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_recv(internal)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_send(hstore)
|
|
|
|
RETURNS bytea
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE TYPE hstore (
|
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = hstore_in,
|
|
|
|
OUTPUT = hstore_out,
|
|
|
|
RECEIVE = hstore_recv,
|
|
|
|
SEND = hstore_send,
|
|
|
|
STORAGE = extended
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_version_diag(hstore)
|
|
|
|
RETURNS integer
|
|
|
|
AS 'MODULE_PATHNAME','hstore_version_diag'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION fetchval(hstore,text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','hstore_fetchval'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR -> (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text,
|
|
|
|
PROCEDURE = fetchval
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION slice_array(hstore,text[])
|
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME','hstore_slice_to_array'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR -> (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text[],
|
|
|
|
PROCEDURE = slice_array
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION slice(hstore,text[])
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION isexists(hstore,text)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_exists'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION exist(hstore,text)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_exists'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ? (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text,
|
|
|
|
PROCEDURE = exist,
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION exists_any(hstore,text[])
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_exists_any'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ?| (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text[],
|
|
|
|
PROCEDURE = exists_any,
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION exists_all(hstore,text[])
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_exists_all'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR ?& (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text[],
|
|
|
|
PROCEDURE = exists_all,
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION isdefined(hstore,text)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_defined'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION defined(hstore,text)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_defined'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION delete(hstore,text)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_delete'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION delete(hstore,text[])
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_delete_array'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION delete(hstore,hstore)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_delete_hstore'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR - (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text,
|
|
|
|
PROCEDURE = delete
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR - (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = text[],
|
|
|
|
PROCEDURE = delete
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR - (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = delete
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION hs_concat(hstore,hstore)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_concat'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR || (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hs_concat
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION hs_contains(hstore,hstore)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_contains'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hs_contained(hstore,hstore)
|
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME','hstore_contained'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR @> (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hs_contains,
|
|
|
|
COMMUTATOR = '<@',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR <@ (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hs_contained,
|
|
|
|
COMMUTATOR = '@>',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
-- obsolete:
|
|
|
|
CREATE OPERATOR @ (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hs_contains,
|
|
|
|
COMMUTATOR = '~',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR ~ (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hs_contained,
|
|
|
|
COMMUTATOR = '@',
|
|
|
|
RESTRICT = contsel,
|
|
|
|
JOIN = contjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION tconvert(text,text)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_from_text'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE PARALLEL SAFE; -- not STRICT; needs to allow (key,NULL)
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore(text,text)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME','hstore_from_text'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE PARALLEL SAFE; -- not STRICT; needs to allow (key,NULL)
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore(text[],text[])
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_from_arrays'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE PARALLEL SAFE; -- not STRICT; allows (keys,null)
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore(text[])
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_from_array'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE CAST (text[] AS hstore)
|
|
|
|
WITH FUNCTION hstore(text[]);
|
|
|
|
|
2013-03-11 05:35:36 +08:00
|
|
|
CREATE FUNCTION hstore_to_json(hstore)
|
|
|
|
RETURNS json
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_to_json'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2013-03-11 05:35:36 +08:00
|
|
|
|
|
|
|
CREATE CAST (hstore AS json)
|
|
|
|
WITH FUNCTION hstore_to_json(hstore);
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_to_json_loose(hstore)
|
|
|
|
RETURNS json
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_to_json_loose'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2013-03-11 05:35:36 +08:00
|
|
|
|
Introduce jsonb, a structured format for storing json.
The new format accepts exactly the same data as the json type. However, it is
stored in a format that does not require reparsing the orgiginal text in order
to process it, making it much more suitable for indexing and other operations.
Insignificant whitespace is discarded, and the order of object keys is not
preserved. Neither are duplicate object keys kept - the later value for a given
key is the only one stored.
The new type has all the functions and operators that the json type has,
with the exception of the json generation functions (to_json, json_agg etc.)
and with identical semantics. In addition, there are operator classes for
hash and btree indexing, and two classes for GIN indexing, that have no
equivalent in the json type.
This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
was intended to provide similar facilities to a nested hstore type, but which
in the end proved to have some significant compatibility issues.
Authors: Oleg Bartunov, Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
Review: Andres Freund
2014-03-24 04:40:19 +08:00
|
|
|
CREATE FUNCTION hstore_to_jsonb(hstore)
|
|
|
|
RETURNS jsonb
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_to_jsonb'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
Introduce jsonb, a structured format for storing json.
The new format accepts exactly the same data as the json type. However, it is
stored in a format that does not require reparsing the orgiginal text in order
to process it, making it much more suitable for indexing and other operations.
Insignificant whitespace is discarded, and the order of object keys is not
preserved. Neither are duplicate object keys kept - the later value for a given
key is the only one stored.
The new type has all the functions and operators that the json type has,
with the exception of the json generation functions (to_json, json_agg etc.)
and with identical semantics. In addition, there are operator classes for
hash and btree indexing, and two classes for GIN indexing, that have no
equivalent in the json type.
This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
was intended to provide similar facilities to a nested hstore type, but which
in the end proved to have some significant compatibility issues.
Authors: Oleg Bartunov, Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
Review: Andres Freund
2014-03-24 04:40:19 +08:00
|
|
|
|
|
|
|
CREATE CAST (hstore AS jsonb)
|
|
|
|
WITH FUNCTION hstore_to_jsonb(hstore);
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_to_jsonb_loose(hstore)
|
|
|
|
RETURNS jsonb
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_to_jsonb_loose'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
Introduce jsonb, a structured format for storing json.
The new format accepts exactly the same data as the json type. However, it is
stored in a format that does not require reparsing the orgiginal text in order
to process it, making it much more suitable for indexing and other operations.
Insignificant whitespace is discarded, and the order of object keys is not
preserved. Neither are duplicate object keys kept - the later value for a given
key is the only one stored.
The new type has all the functions and operators that the json type has,
with the exception of the json generation functions (to_json, json_agg etc.)
and with identical semantics. In addition, there are operator classes for
hash and btree indexing, and two classes for GIN indexing, that have no
equivalent in the json type.
This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
was intended to provide similar facilities to a nested hstore type, but which
in the end proved to have some significant compatibility issues.
Authors: Oleg Bartunov, Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
Review: Andres Freund
2014-03-24 04:40:19 +08:00
|
|
|
|
2011-11-08 10:47:45 +08:00
|
|
|
CREATE FUNCTION hstore(record)
|
|
|
|
RETURNS hstore
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_from_record'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE PARALLEL SAFE; -- not STRICT; allows (null::recordtype)
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_to_array(hstore)
|
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME','hstore_to_array'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR %% (
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_to_array
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_to_matrix(hstore)
|
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME','hstore_to_matrix'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR %# (
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_to_matrix
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION akeys(hstore)
|
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME','hstore_akeys'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION avals(hstore)
|
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME','hstore_avals'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION skeys(hstore)
|
|
|
|
RETURNS setof text
|
|
|
|
AS 'MODULE_PATHNAME','hstore_skeys'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION svals(hstore)
|
|
|
|
RETURNS setof text
|
|
|
|
AS 'MODULE_PATHNAME','hstore_svals'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION each(IN hs hstore,
|
|
|
|
OUT key text,
|
|
|
|
OUT value text)
|
|
|
|
RETURNS SETOF record
|
|
|
|
AS 'MODULE_PATHNAME','hstore_each'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION populate_record(anyelement,hstore)
|
|
|
|
RETURNS anyelement
|
|
|
|
AS 'MODULE_PATHNAME', 'hstore_populate_record'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE PARALLEL SAFE; -- not STRICT; allows (null::rectype,hstore)
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR #= (
|
|
|
|
LEFTARG = anyelement,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = populate_record
|
|
|
|
);
|
|
|
|
|
|
|
|
-- btree support
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_eq(hstore,hstore)
|
|
|
|
RETURNS boolean
|
|
|
|
AS 'MODULE_PATHNAME','hstore_eq'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_ne(hstore,hstore)
|
|
|
|
RETURNS boolean
|
|
|
|
AS 'MODULE_PATHNAME','hstore_ne'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_gt(hstore,hstore)
|
|
|
|
RETURNS boolean
|
|
|
|
AS 'MODULE_PATHNAME','hstore_gt'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_ge(hstore,hstore)
|
|
|
|
RETURNS boolean
|
|
|
|
AS 'MODULE_PATHNAME','hstore_ge'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_lt(hstore,hstore)
|
|
|
|
RETURNS boolean
|
|
|
|
AS 'MODULE_PATHNAME','hstore_lt'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_le(hstore,hstore)
|
|
|
|
RETURNS boolean
|
|
|
|
AS 'MODULE_PATHNAME','hstore_le'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION hstore_cmp(hstore,hstore)
|
|
|
|
RETURNS integer
|
|
|
|
AS 'MODULE_PATHNAME','hstore_cmp'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR = (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_eq,
|
|
|
|
COMMUTATOR = =,
|
|
|
|
NEGATOR = <>,
|
|
|
|
RESTRICT = eqsel,
|
|
|
|
JOIN = eqjoinsel,
|
|
|
|
MERGES,
|
|
|
|
HASHES
|
|
|
|
);
|
|
|
|
CREATE OPERATOR <> (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_ne,
|
|
|
|
COMMUTATOR = <>,
|
|
|
|
NEGATOR = =,
|
|
|
|
RESTRICT = neqsel,
|
|
|
|
JOIN = neqjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
-- the comparison operators have funky names (and are undocumented)
|
|
|
|
-- in an attempt to discourage anyone from actually using them. they
|
|
|
|
-- only exist to support the btree opclass
|
|
|
|
|
|
|
|
CREATE OPERATOR #<# (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_lt,
|
|
|
|
COMMUTATOR = #>#,
|
|
|
|
NEGATOR = #>=#,
|
|
|
|
RESTRICT = scalarltsel,
|
|
|
|
JOIN = scalarltjoinsel
|
|
|
|
);
|
|
|
|
CREATE OPERATOR #<=# (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_le,
|
|
|
|
COMMUTATOR = #>=#,
|
|
|
|
NEGATOR = #>#,
|
|
|
|
RESTRICT = scalarltsel,
|
|
|
|
JOIN = scalarltjoinsel
|
|
|
|
);
|
|
|
|
CREATE OPERATOR #># (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_gt,
|
|
|
|
COMMUTATOR = #<#,
|
|
|
|
NEGATOR = #<=#,
|
|
|
|
RESTRICT = scalargtsel,
|
|
|
|
JOIN = scalargtjoinsel
|
|
|
|
);
|
|
|
|
CREATE OPERATOR #>=# (
|
|
|
|
LEFTARG = hstore,
|
|
|
|
RIGHTARG = hstore,
|
|
|
|
PROCEDURE = hstore_ge,
|
|
|
|
COMMUTATOR = #<=#,
|
|
|
|
NEGATOR = #<#,
|
|
|
|
RESTRICT = scalargtsel,
|
|
|
|
JOIN = scalargtjoinsel
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE OPERATOR CLASS btree_hstore_ops
|
|
|
|
DEFAULT FOR TYPE hstore USING btree
|
|
|
|
AS
|
|
|
|
OPERATOR 1 #<# ,
|
|
|
|
OPERATOR 2 #<=# ,
|
|
|
|
OPERATOR 3 = ,
|
|
|
|
OPERATOR 4 #>=# ,
|
|
|
|
OPERATOR 5 #># ,
|
|
|
|
FUNCTION 1 hstore_cmp(hstore,hstore);
|
|
|
|
|
|
|
|
-- hash support
|
|
|
|
|
|
|
|
CREATE FUNCTION hstore_hash(hstore)
|
|
|
|
RETURNS integer
|
|
|
|
AS 'MODULE_PATHNAME','hstore_hash'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR CLASS hash_hstore_ops
|
|
|
|
DEFAULT FOR TYPE hstore USING hash
|
|
|
|
AS
|
|
|
|
OPERATOR 1 = ,
|
|
|
|
FUNCTION 1 hstore_hash(hstore);
|
|
|
|
|
|
|
|
-- GiST support
|
|
|
|
|
|
|
|
CREATE TYPE ghstore;
|
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_in(cstring)
|
|
|
|
RETURNS ghstore
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_out(ghstore)
|
|
|
|
RETURNS cstring
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE TYPE ghstore (
|
|
|
|
INTERNALLENGTH = -1,
|
|
|
|
INPUT = ghstore_in,
|
|
|
|
OUTPUT = ghstore_out
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_compress(internal)
|
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_decompress(internal)
|
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_penalty(internal,internal,internal)
|
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_picksplit(internal, internal)
|
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE FUNCTION ghstore_union(internal, internal)
|
Fix assorted inconsistencies in GiST opclass support function declarations.
The conventions specified by the GiST SGML documentation were widely
ignored. For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum. None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures. So let's try to instill
some consistency here.
Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types). Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same. So I've specified a convention
that that's what to do always.
Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that. Standardize
on telling the truth, instead.
Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".
Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.
Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.
So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion. Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.
2016-01-20 01:04:32 +08:00
|
|
|
RETURNS ghstore
|
2011-11-08 10:47:45 +08:00
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
Fix assorted inconsistencies in GiST opclass support function declarations.
The conventions specified by the GiST SGML documentation were widely
ignored. For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum. None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures. So let's try to instill
some consistency here.
Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types). Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same. So I've specified a convention
that that's what to do always.
Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that. Standardize
on telling the truth, instead.
Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".
Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.
Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.
So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion. Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.
2016-01-20 01:04:32 +08:00
|
|
|
CREATE FUNCTION ghstore_same(ghstore, ghstore, internal)
|
2011-11-08 10:47:45 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
Fix assorted inconsistencies in GiST opclass support function declarations.
The conventions specified by the GiST SGML documentation were widely
ignored. For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum. None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures. So let's try to instill
some consistency here.
Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types). Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same. So I've specified a convention
that that's what to do always.
Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that. Standardize
on telling the truth, instead.
Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".
Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.
Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.
So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion. Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.
2016-01-20 01:04:32 +08:00
|
|
|
CREATE FUNCTION ghstore_consistent(internal,hstore,smallint,oid,internal)
|
2011-11-08 10:47:45 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR CLASS gist_hstore_ops
|
|
|
|
DEFAULT FOR TYPE hstore USING gist
|
|
|
|
AS
|
|
|
|
OPERATOR 7 @> ,
|
|
|
|
OPERATOR 9 ?(hstore,text) ,
|
|
|
|
OPERATOR 10 ?|(hstore,text[]) ,
|
|
|
|
OPERATOR 11 ?&(hstore,text[]) ,
|
|
|
|
--OPERATOR 8 <@ ,
|
|
|
|
OPERATOR 13 @ ,
|
|
|
|
--OPERATOR 14 ~ ,
|
Fix assorted inconsistencies in GiST opclass support function declarations.
The conventions specified by the GiST SGML documentation were widely
ignored. For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum. None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures. So let's try to instill
some consistency here.
Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types). Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same. So I've specified a convention
that that's what to do always.
Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that. Standardize
on telling the truth, instead.
Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".
Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.
Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.
So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion. Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.
2016-01-20 01:04:32 +08:00
|
|
|
FUNCTION 1 ghstore_consistent (internal, hstore, smallint, oid, internal),
|
2011-11-08 10:47:45 +08:00
|
|
|
FUNCTION 2 ghstore_union (internal, internal),
|
|
|
|
FUNCTION 3 ghstore_compress (internal),
|
|
|
|
FUNCTION 4 ghstore_decompress (internal),
|
|
|
|
FUNCTION 5 ghstore_penalty (internal, internal, internal),
|
|
|
|
FUNCTION 6 ghstore_picksplit (internal, internal),
|
Fix assorted inconsistencies in GiST opclass support function declarations.
The conventions specified by the GiST SGML documentation were widely
ignored. For example, the strategy-number argument for "consistent" and
"distance" functions is specified to be a smallint, but most of the
built-in support functions declared it as an integer, and for that matter
the core code passed it using Int32GetDatum not Int16GetDatum. None of
that makes any real difference at runtime, but it's quite confusing for
newcomers to the code, and it makes it very hard to write an amvalidate()
function that checks support function signatures. So let's try to instill
some consistency here.
Another similar issue is that the "query" argument is not of a single
well-defined type, but could have different types depending on the strategy
(corresponding to search operators with different righthand-side argument
types). Some of the functions threw up their hands and declared the query
argument as being of "internal" type, which surely isn't right ("any" would
have been more appropriate); but the majority position seemed to be to
declare it as being of the indexed data type, corresponding to a search
operator with both input types the same. So I've specified a convention
that that's what to do always.
Also, the result of the "union" support function actually must be of the
index's storage type, but the documentation suggested declaring it to
return "internal", and some of the functions followed that. Standardize
on telling the truth, instead.
Similarly, standardize on declaring the "same" function's inputs as
being of the storage type, not "internal".
Also, somebody had forgotten to add the "recheck" argument to both
the documentation of the "distance" support function and all of their
SQL declarations, even though the C code was happily using that argument.
Clean that up too.
Fix up some other omissions in the docs too, such as documenting that
union's second input argument is vestigial.
So far as the errors in core function declarations go, we can just fix
pg_proc.h and bump catversion. Adjusting the erroneous declarations in
contrib modules is more debatable: in principle any change in those
scripts should involve an extension version bump, which is a pain.
However, since these changes are purely cosmetic and make no functional
difference, I think we can get away without doing that.
2016-01-20 01:04:32 +08:00
|
|
|
FUNCTION 7 ghstore_same (ghstore, ghstore, internal),
|
2011-11-08 10:47:45 +08:00
|
|
|
STORAGE ghstore;
|
|
|
|
|
|
|
|
-- GIN support
|
|
|
|
|
2016-01-20 11:32:19 +08:00
|
|
|
CREATE FUNCTION gin_extract_hstore(hstore, internal)
|
2011-11-08 10:47:45 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
2016-01-20 11:32:19 +08:00
|
|
|
CREATE FUNCTION gin_extract_hstore_query(hstore, internal, int2, internal, internal)
|
2011-11-08 10:47:45 +08:00
|
|
|
RETURNS internal
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
2016-01-20 11:32:19 +08:00
|
|
|
CREATE FUNCTION gin_consistent_hstore(internal, int2, hstore, int4, internal, internal)
|
2011-11-08 10:47:45 +08:00
|
|
|
RETURNS bool
|
|
|
|
AS 'MODULE_PATHNAME'
|
2016-06-15 01:34:37 +08:00
|
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
2011-11-08 10:47:45 +08:00
|
|
|
|
|
|
|
CREATE OPERATOR CLASS gin_hstore_ops
|
|
|
|
DEFAULT FOR TYPE hstore USING gin
|
|
|
|
AS
|
|
|
|
OPERATOR 7 @>,
|
|
|
|
OPERATOR 9 ?(hstore,text),
|
|
|
|
OPERATOR 10 ?|(hstore,text[]),
|
|
|
|
OPERATOR 11 ?&(hstore,text[]),
|
|
|
|
FUNCTION 1 bttextcmp(text,text),
|
2016-01-20 11:32:19 +08:00
|
|
|
FUNCTION 2 gin_extract_hstore(hstore, internal),
|
|
|
|
FUNCTION 3 gin_extract_hstore_query(hstore, internal, int2, internal, internal),
|
|
|
|
FUNCTION 4 gin_consistent_hstore(internal, int2, hstore, int4, internal, internal),
|
2011-11-08 10:47:45 +08:00
|
|
|
STORAGE text;
|