Project

General

Profile

« Previous | Next » 

Revision 12561

schemas/util.sql: added mk_keys_func(regtype, col_cast[])

View differences:

trunk/schemas/util.sql
2067 2067

  
2068 2068

  
2069 2069
--
2070
-- Name: mk_keys_func(regtype, col_cast[]); Type: FUNCTION; Schema: util; Owner: -
2071
--
2072

  
2073
CREATE FUNCTION mk_keys_func(type regtype, cols col_cast[]) RETURNS void
2074
    LANGUAGE sql IMMUTABLE
2075
    AS $_$
2076
SELECT util.eval($$
2077
CREATE OR REPLACE FUNCTION $$||util.schema($1)||$$.keys(value $$
2078
||util.qual_name($1)||util.mk_out_params($2)||$$)
2079
  RETURNS record AS
2080
$BODY1$
2081
SELECT ROW($$||
2082
(SELECT COALESCE(string_agg($$$1.$$||(unnest).col_name, ', '), '')
2083
FROM unnest($2)) ||$$)
2084
$BODY1$
2085
  LANGUAGE sql IMMUTABLE
2086
  COST 100;
2087
$$)
2088
$_$;
2089

  
2090

  
2091
--
2070 2092
-- Name: mk_map_table(text); Type: FUNCTION; Schema: util; Owner: -
2071 2093
--
2072 2094

  

Also available in: Unified diff