Project

General

Profile

« Previous | Next » 

Revision 10307

schemas/util.sql: added hstore(keys text[], value text), which can be used to avoid repeating the same value for each key. there are many /_map filters which use the XPath syntax for doing this, which now need to use an equivalent SQL syntax to avoid duplicating the value many times.

View differences:

util.sql
974 974

  
975 975

  
976 976
--
977
-- Name: hstore(text[], text); Type: FUNCTION; Schema: util; Owner: -
978
--
979

  
980
CREATE FUNCTION hstore(keys text[], value text) RETURNS hstore
981
    LANGUAGE sql IMMUTABLE
982
    AS $_$
983
SELECT hstore($1, util.array_fill($2, util.array_length($1)))
984
$_$;
985

  
986

  
987
--
988
-- Name: FUNCTION hstore(keys text[], value text); Type: COMMENT; Schema: util; Owner: -
989
--
990

  
991
COMMENT ON FUNCTION hstore(keys text[], value text) IS 'avoids repeating the same value for each key';
992

  
993

  
994
--
977 995
-- Name: is_constant(col_ref); Type: FUNCTION; Schema: util; Owner: -
978 996
--
979 997

  

Also available in: Unified diff