Project

General

Profile

« Previous | Next » 

Revision 10327

schemas/util.sql: added hstore(keys anyarray, value anyelement) and => (anyarray, anyelement) operator to support other element types for hstore

View differences:

util.sql
1044 1044

  
1045 1045

  
1046 1046
--
1047
-- Name: hstore(anyarray, anyelement); Type: FUNCTION; Schema: util; Owner: -
1048
--
1049

  
1050
CREATE FUNCTION hstore(keys anyarray, value anyelement) RETURNS hstore
1051
    LANGUAGE sql IMMUTABLE
1052
    AS $_$
1053
SELECT util.hstore($1::text[], $2::text)
1054
$_$;
1055

  
1056

  
1057
--
1058
-- Name: FUNCTION hstore(keys anyarray, value anyelement); Type: COMMENT; Schema: util; Owner: -
1059
--
1060

  
1061
COMMENT ON FUNCTION hstore(keys anyarray, value anyelement) IS 'avoids repeating the same value for each key';
1062

  
1063

  
1064
--
1047 1065
-- Name: is_constant(col_ref); Type: FUNCTION; Schema: util; Owner: -
1048 1066
--
1049 1067

  
......
1753 1771

  
1754 1772
CREATE OPERATOR => (
1755 1773
    PROCEDURE = hstore,
1756
    LEFTARG = text[],
1757
    RIGHTARG = text
1774
    LEFTARG = anyarray,
1775
    RIGHTARG = anyelement
1758 1776
);
1759 1777

  
1760 1778

  
1761 1779
--
1762
-- Name: OPERATOR => (text[], text); Type: COMMENT; Schema: util; Owner: -
1780
-- Name: OPERATOR => (anyarray, anyelement); Type: COMMENT; Schema: util; Owner: -
1763 1781
--
1764 1782

  
1765
COMMENT ON OPERATOR => (text[], text) IS 'usage: array[''key1'', ...] => ''value''';
1783
COMMENT ON OPERATOR => (anyarray, anyelement) IS 'usage: array[''key1'', ...]::text[] => ''value''';
1766 1784

  
1767 1785

  
1768 1786
SET default_tablespace = '';

Also available in: Unified diff