Revision 2939
Added by Aaron Marcuse-Kubitza over 12 years ago
schemas/functions.sql | ||
---|---|---|
36 | 36 |
LANGUAGE plpgsql IMMUTABLE |
37 | 37 |
AS $$ |
38 | 38 |
BEGIN |
39 |
new.result := coalesce(new."0", new."1", new."2", new."3", new."4", new."5",
|
|
39 |
new.result := _alt(new."0", new."1", new."2", new."3", new."4", new."5",
|
|
40 | 40 |
new."6", new."7", new."8", new."9"); |
41 | 41 |
RETURN new; |
42 | 42 |
END; |
... | ... | |
44 | 44 |
|
45 | 45 |
|
46 | 46 |
-- |
47 |
-- Name: _alt(text, text, text, text, text, text, text, text, text, text); Type: FUNCTION; Schema: functions; Owner: - |
|
48 |
-- |
|
49 |
|
|
50 |
CREATE FUNCTION _alt("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 |
|
51 |
LANGUAGE sql IMMUTABLE |
|
52 |
AS $_$ |
|
53 |
SELECT coalesce($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) |
|
54 |
$_$; |
|
55 |
|
|
56 |
|
|
57 |
-- |
|
47 | 58 |
-- Name: _label(); Type: FUNCTION; Schema: functions; Owner: - |
48 | 59 |
-- |
49 | 60 |
|
... | ... | |
429 | 440 |
-- Name: _alt; Type: TRIGGER; Schema: functions; Owner: - |
430 | 441 |
-- |
431 | 442 |
|
432 |
CREATE TRIGGER _alt BEFORE INSERT OR UPDATE ON _alt FOR EACH ROW EXECUTE PROCEDURE _alt(); |
|
443 |
CREATE TRIGGER _alt BEFORE INSERT OR UPDATE ON _alt FOR EACH ROW EXECUTE PROCEDURE functions._alt();
|
|
433 | 444 |
|
434 | 445 |
|
435 | 446 |
-- |
Also available in: Unified diff
schemas/functions.sql: Added plain function _alt() and use it in trigger function _alt()