Revision 4147
Added by Aaron Marcuse-Kubitza over 12 years ago
schemas/functions.sql | ||
---|---|---|
51 | 51 |
|
52 | 52 |
|
53 | 53 |
-- |
54 |
-- Name: _if(boolean, anyelement, anyelement); Type: FUNCTION; Schema: functions; Owner: - |
|
55 |
-- |
|
56 |
|
|
57 |
CREATE FUNCTION _if(cond boolean DEFAULT NULL::boolean, "then" anyelement DEFAULT NULL::unknown, "else" anyelement DEFAULT NULL::unknown) RETURNS anyelement |
|
58 |
LANGUAGE sql IMMUTABLE |
|
59 |
AS $_$ |
|
60 |
SELECT (CASE WHEN $1 THEN $2 ELSE $3 END) |
|
61 |
$_$; |
|
62 |
|
|
63 |
|
|
64 |
-- |
|
65 |
-- Name: _if(text, anyelement, anyelement); Type: FUNCTION; Schema: functions; Owner: - |
|
66 |
-- |
|
67 |
|
|
68 |
CREATE FUNCTION _if(cond text DEFAULT NULL::text, "then" anyelement DEFAULT NULL::unknown, "else" anyelement DEFAULT NULL::unknown) RETURNS anyelement |
|
69 |
LANGUAGE sql IMMUTABLE |
|
70 |
AS $_$ |
|
71 |
SELECT functions._if($1 != '', $2, $3) |
|
72 |
$_$; |
|
73 |
|
|
74 |
|
|
75 |
-- |
|
54 | 76 |
-- Name: _label(text, text); Type: FUNCTION; Schema: functions; Owner: - |
55 | 77 |
-- |
56 | 78 |
|
Also available in: Unified diff
schemas/functions.sql: Added _if()