1 |
2094
|
aaronmk
|
--
|
2 |
|
|
-- PostgreSQL database dump
|
3 |
|
|
--
|
4 |
|
|
|
5 |
|
|
SET statement_timeout = 0;
|
6 |
|
|
SET client_encoding = 'UTF8';
|
7 |
|
|
SET standard_conforming_strings = off;
|
8 |
|
|
SET check_function_bodies = false;
|
9 |
|
|
SET client_min_messages = warning;
|
10 |
|
|
SET escape_string_warning = off;
|
11 |
|
|
|
12 |
|
|
--
|
13 |
|
|
-- Name: functions; Type: SCHEMA; Schema: -; Owner: -
|
14 |
|
|
--
|
15 |
|
|
|
16 |
|
|
CREATE SCHEMA functions;
|
17 |
|
|
|
18 |
|
|
|
19 |
2107
|
aaronmk
|
SET search_path = functions, pg_catalog;
|
20 |
|
|
|
21 |
2094
|
aaronmk
|
--
|
22 |
2138
|
aaronmk
|
-- 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 |
|
|
--
|
36 |
2107
|
aaronmk
|
-- Name: _toDouble(); Type: FUNCTION; Schema: functions; Owner: -
|
37 |
|
|
--
|
38 |
|
|
|
39 |
|
|
CREATE FUNCTION "_toDouble"() RETURNS trigger
|
40 |
2135
|
aaronmk
|
LANGUAGE plpgsql IMMUTABLE
|
41 |
2107
|
aaronmk
|
AS $$
|
42 |
|
|
BEGIN
|
43 |
|
|
new.result := CAST(new.value AS double precision);
|
44 |
|
|
RETURN new;
|
45 |
|
|
END;
|
46 |
|
|
$$;
|
47 |
|
|
|
48 |
|
|
|
49 |
2249
|
aaronmk
|
--
|
50 |
|
|
-- Name: _toTimestamp(); Type: FUNCTION; Schema: functions; Owner: -
|
51 |
|
|
--
|
52 |
|
|
|
53 |
|
|
CREATE FUNCTION "_toTimestamp"() RETURNS trigger
|
54 |
|
|
LANGUAGE plpgsql IMMUTABLE
|
55 |
|
|
AS $$
|
56 |
|
|
BEGIN
|
57 |
|
|
new.result := CAST(new.value AS timestamp with time zone);
|
58 |
|
|
RETURN new;
|
59 |
|
|
END;
|
60 |
|
|
$$;
|
61 |
|
|
|
62 |
|
|
|
63 |
2107
|
aaronmk
|
SET default_tablespace = '';
|
64 |
|
|
|
65 |
|
|
SET default_with_oids = false;
|
66 |
|
|
|
67 |
|
|
--
|
68 |
2138
|
aaronmk
|
-- Name: _toBool; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
69 |
2107
|
aaronmk
|
--
|
70 |
|
|
|
71 |
2138
|
aaronmk
|
CREATE TABLE "_toBool" (
|
72 |
|
|
result boolean,
|
73 |
2107
|
aaronmk
|
value text
|
74 |
|
|
);
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
--
|
78 |
2138
|
aaronmk
|
-- Name: _toDouble; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
79 |
2107
|
aaronmk
|
--
|
80 |
|
|
|
81 |
2138
|
aaronmk
|
CREATE TABLE "_toDouble" (
|
82 |
|
|
result double precision,
|
83 |
|
|
value text
|
84 |
|
|
);
|
85 |
2107
|
aaronmk
|
|
86 |
|
|
|
87 |
|
|
--
|
88 |
2249
|
aaronmk
|
-- Name: _toTimestamp; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
89 |
|
|
--
|
90 |
|
|
|
91 |
|
|
CREATE TABLE "_toTimestamp" (
|
92 |
|
|
result timestamp with time zone,
|
93 |
|
|
value text
|
94 |
|
|
);
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
--
|
98 |
2138
|
aaronmk
|
-- Name: _toBool_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
99 |
2107
|
aaronmk
|
--
|
100 |
|
|
|
101 |
2138
|
aaronmk
|
CREATE UNIQUE INDEX "_toBool_unique" ON "_toBool" USING btree ((COALESCE(value, '\\N'::text)));
|
102 |
2107
|
aaronmk
|
|
103 |
|
|
|
104 |
|
|
--
|
105 |
2138
|
aaronmk
|
-- Name: _toDouble_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
106 |
2094
|
aaronmk
|
--
|
107 |
|
|
|
108 |
2138
|
aaronmk
|
CREATE UNIQUE INDEX "_toDouble_unique" ON "_toDouble" USING btree ((COALESCE(value, '\\N'::text)));
|
109 |
2136
|
aaronmk
|
|
110 |
|
|
|
111 |
|
|
--
|
112 |
2249
|
aaronmk
|
-- Name: _toTimestamp_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
113 |
|
|
--
|
114 |
|
|
|
115 |
|
|
CREATE UNIQUE INDEX "_toTimestamp_unique" ON "_toTimestamp" USING btree ((COALESCE(value, '\\N'::text)));
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
--
|
119 |
2138
|
aaronmk
|
-- Name: _toBool; Type: TRIGGER; Schema: functions; Owner: -
|
120 |
2136
|
aaronmk
|
--
|
121 |
|
|
|
122 |
2138
|
aaronmk
|
CREATE TRIGGER "_toBool" BEFORE INSERT OR UPDATE ON "_toBool" FOR EACH ROW EXECUTE PROCEDURE "_toBool"();
|
123 |
2136
|
aaronmk
|
|
124 |
|
|
|
125 |
|
|
--
|
126 |
2138
|
aaronmk
|
-- Name: _toDouble; Type: TRIGGER; Schema: functions; Owner: -
|
127 |
2136
|
aaronmk
|
--
|
128 |
|
|
|
129 |
2138
|
aaronmk
|
CREATE TRIGGER "_toDouble" BEFORE INSERT OR UPDATE ON "_toDouble" FOR EACH ROW EXECUTE PROCEDURE "_toDouble"();
|
130 |
2136
|
aaronmk
|
|
131 |
|
|
|
132 |
|
|
--
|
133 |
2249
|
aaronmk
|
-- Name: _toTimestamp; Type: TRIGGER; Schema: functions; Owner: -
|
134 |
|
|
--
|
135 |
|
|
|
136 |
|
|
CREATE TRIGGER "_toTimestamp" BEFORE INSERT OR UPDATE ON "_toTimestamp" FOR EACH ROW EXECUTE PROCEDURE "_toTimestamp"();
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
--
|
140 |
2136
|
aaronmk
|
-- PostgreSQL database dump complete
|
141 |
|
|
--
|