Project

General

Profile

« Previous | Next » 

Revision 12570

schemas/util.sql: mk_keys_func(regtype): also add values() function for use in displaying the diff table

View differences:

trunk/schemas/util.sql
2074 2074
CREATE FUNCTION mk_keys_func(type regtype) RETURNS void
2075 2075
    LANGUAGE sql IMMUTABLE
2076 2076
    AS $_$
2077
-- keys()
2077 2078
SELECT util.mk_keys_func($1, ARRAY(
2078 2079
SELECT col FROM util.typed_cols($1) col
2079 2080
WHERE (col).type != ANY('{bigint}'::regtype[]) -- not a count col
2080
))
2081
));
2082

  
2083
-- values()
2084
SELECT util.mk_keys_func($1, COALESCE(
2085
	NULLIF(ARRAY(
2086
	SELECT col FROM util.typed_cols($1) col
2087
	WHERE (col).type = ANY('{bigint}'::regtype[]) -- is a count col
2088
	), ARRAY[]::util.col_cast[])
2089
, ARRAY(SELECT util.typed_cols($1))) -- no count cols, so use all cols
2090
, 'values');
2081 2091
$_$;
2082 2092

  
2083 2093

  

Also available in: Unified diff