Revision 2138
Added by Aaron Marcuse-Kubitza over 12 years ago
schemas/functions.sql | ||
---|---|---|
19 | 19 |
SET search_path = functions, pg_catalog; |
20 | 20 |
|
21 | 21 |
-- |
22 |
-- Name: _toBool(); Type: FUNCTION; Schema: functions; Owner: - |
|
23 |
-- |
|
24 |
|
|
25 |
CREATE FUNCTION "_toBool"() RETURNS trigger |
|
26 |
LANGUAGE plpgsql IMMUTABLE |
|
27 |
AS $$ |
|
28 |
BEGIN |
|
29 |
new.result := CAST(new.value AS boolean); |
|
30 |
RETURN new; |
|
31 |
END; |
|
32 |
$$; |
|
33 |
|
|
34 |
|
|
35 |
-- |
|
22 | 36 |
-- Name: _toDouble(); Type: FUNCTION; Schema: functions; Owner: - |
23 | 37 |
-- |
24 | 38 |
|
... | ... | |
37 | 51 |
SET default_with_oids = false; |
38 | 52 |
|
39 | 53 |
-- |
40 |
-- Name: _toDouble; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
|
54 |
-- Name: _toBool; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
|
41 | 55 |
-- |
42 | 56 |
|
43 |
CREATE TABLE "_toDouble" (
|
|
44 |
result double precision,
|
|
57 |
CREATE TABLE "_toBool" (
|
|
58 |
result boolean,
|
|
45 | 59 |
value text |
46 | 60 |
); |
47 | 61 |
|
48 | 62 |
|
49 | 63 |
-- |
50 |
-- Name: _toDouble_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
|
64 |
-- Name: _toDouble; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
|
51 | 65 |
-- |
52 | 66 |
|
53 |
CREATE UNIQUE INDEX "_toDouble_unique" ON "_toDouble" USING btree ((COALESCE(value, '\\N'::text))); |
|
67 |
CREATE TABLE "_toDouble" ( |
|
68 |
result double precision, |
|
69 |
value text |
|
70 |
); |
|
54 | 71 |
|
55 | 72 |
|
56 | 73 |
-- |
57 |
-- Name: _toDouble; Type: TRIGGER; Schema: functions; Owner: -
|
|
74 |
-- Name: _toBool_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
|
58 | 75 |
-- |
59 | 76 |
|
60 |
CREATE TRIGGER "_toDouble" BEFORE INSERT OR UPDATE ON "_toDouble" FOR EACH ROW EXECUTE PROCEDURE "_toDouble"();
|
|
77 |
CREATE UNIQUE INDEX "_toBool_unique" ON "_toBool" USING btree ((COALESCE(value, '\\N'::text)));
|
|
61 | 78 |
|
62 | 79 |
|
63 | 80 |
-- |
64 |
-- PostgreSQL database dump complete
|
|
81 |
-- Name: _toDouble_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
|
65 | 82 |
-- |
66 | 83 |
|
84 |
CREATE UNIQUE INDEX "_toDouble_unique" ON "_toDouble" USING btree ((COALESCE(value, '\\N'::text))); |
|
67 | 85 |
|
68 |
-- |
|
69 |
-- Name: _toBool(); Type: FUNCTION; Schema: functions; Owner: - |
|
70 |
-- |
|
71 | 86 |
|
72 |
CREATE FUNCTION "_toBool"() RETURNS trigger |
|
73 |
LANGUAGE plpgsql IMMUTABLE |
|
74 |
AS $$ |
|
75 |
BEGIN |
|
76 |
new.result := CAST(new.value AS boolean); |
|
77 |
RETURN new; |
|
78 |
END; |
|
79 |
$$; |
|
80 |
|
|
81 |
|
|
82 |
SET default_tablespace = ''; |
|
83 |
|
|
84 |
SET default_with_oids = false; |
|
85 |
|
|
86 | 87 |
-- |
87 |
-- Name: _toBool; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
|
88 |
-- Name: _toBool; Type: TRIGGER; Schema: functions; Owner: -
|
|
88 | 89 |
-- |
89 | 90 |
|
90 |
CREATE TABLE "_toBool" ( |
|
91 |
result boolean, |
|
92 |
value text |
|
93 |
); |
|
91 |
CREATE TRIGGER "_toBool" BEFORE INSERT OR UPDATE ON "_toBool" FOR EACH ROW EXECUTE PROCEDURE "_toBool"(); |
|
94 | 92 |
|
95 | 93 |
|
96 | 94 |
-- |
97 |
-- Name: _toBool_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
|
95 |
-- Name: _toDouble; Type: TRIGGER; Schema: functions; Owner: -
|
|
98 | 96 |
-- |
99 | 97 |
|
100 |
CREATE UNIQUE INDEX "_toBool_unique" ON "_toBool" USING btree ((COALESCE(value, '\\N'::text)));
|
|
98 |
CREATE TRIGGER "_toDouble" BEFORE INSERT OR UPDATE ON "_toDouble" FOR EACH ROW EXECUTE PROCEDURE "_toDouble"();
|
|
101 | 99 |
|
102 | 100 |
|
103 | 101 |
-- |
104 |
-- Name: _toBool; Type: TRIGGER; Schema: functions; Owner: - |
|
105 |
-- |
|
106 |
|
|
107 |
CREATE TRIGGER "_toBool" BEFORE INSERT OR UPDATE ON "_toBool" FOR EACH ROW EXECUTE PROCEDURE "_toBool"(); |
|
108 |
|
|
109 |
|
|
110 |
-- |
|
111 | 102 |
-- PostgreSQL database dump complete |
112 | 103 |
-- |
113 | 104 |
|
Also available in: Unified diff
schemas/functions.sql: Added _toBool