Project

General

Profile

« Previous | Next » 

Revision 12569

schemas/util.sql: mk_keys_func(regtype, col_cast[]): allow changing the name of the generated function

View differences:

util.sql
2082 2082

  
2083 2083

  
2084 2084
--
2085
-- Name: mk_keys_func(regtype, col_cast[]); Type: FUNCTION; Schema: util; Owner: -
2085
-- Name: mk_keys_func(regtype, col_cast[], text); Type: FUNCTION; Schema: util; Owner: -
2086 2086
--
2087 2087

  
2088
CREATE FUNCTION mk_keys_func(type regtype, cols col_cast[]) RETURNS void
2088
CREATE FUNCTION mk_keys_func(type regtype, cols col_cast[], name text DEFAULT 'keys'::text) RETURNS void
2089 2089
    LANGUAGE sql IMMUTABLE
2090 2090
    AS $_$
2091 2091
SELECT util.create_if_not_exists($$
2092
CREATE OR REPLACE FUNCTION $$||util.schema($1)||$$.keys(value $$
2092
CREATE OR REPLACE FUNCTION $$||util.schema($1)||$$.$$||$3||$$(value $$
2093 2093
||util.qual_name($1)||util.mk_out_params($2)||$$)
2094 2094
  RETURNS $$||util._if(util.array_length($2) = 1, $2[1].type::text, $$record$$)
2095 2095
||$$ AS

Also available in: Unified diff