Revision 4053
Added by Aaron Marcuse-Kubitza over 12 years ago
functions.sql | ||
---|---|---|
61 | 61 |
CREATE FUNCTION _merge("0" text DEFAULT NULL::text, "1" text DEFAULT NULL::text, "2" text DEFAULT NULL::text, "3" text DEFAULT NULL::text, "4" text DEFAULT NULL::text, "5" text DEFAULT NULL::text, "6" text DEFAULT NULL::text, "7" text DEFAULT NULL::text, "8" text DEFAULT NULL::text, "9" text DEFAULT NULL::text) RETURNS text |
62 | 62 |
LANGUAGE sql IMMUTABLE |
63 | 63 |
AS $_$ |
64 |
SELECT functions.join_strs('; ', value)
|
|
64 |
SELECT functions.join_strs(value, '; ')
|
|
65 | 65 |
FROM |
66 | 66 |
( |
67 | 67 |
SELECT * |
... | ... | |
124 | 124 |
-- Name: join_strs_transform(text, text, text); Type: FUNCTION; Schema: functions; Owner: - |
125 | 125 |
-- |
126 | 126 |
|
127 |
CREATE FUNCTION join_strs_transform(state text, delim text, value text) RETURNS text
|
|
127 |
CREATE FUNCTION join_strs_transform(state text, value text, delim text) RETURNS text
|
|
128 | 128 |
LANGUAGE sql IMMUTABLE |
129 | 129 |
AS $_$ |
130 | 130 |
SELECT (CASE |
131 | 131 |
WHEN $1 IS NOT NULL AND $3 IS NOT NULL |
132 |
THEN $1 || $2 || $3
|
|
133 |
ELSE COALESCE($1, $3)
|
|
132 |
THEN $1 || $3 || $2
|
|
133 |
ELSE COALESCE($1, $2)
|
|
134 | 134 |
END) |
135 | 135 |
$_$; |
136 | 136 |
|
Also available in: Unified diff
schemas/functions.sql: join_strs(), join_strs_transform(): Reversed order of params to enable strict optimization, which replaces the state value with the first parameter, which used to be the delimiter (http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html#AEN51596)