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 |
|
|
SET default_tablespace = '';
|
50 |
|
|
|
51 |
|
|
SET default_with_oids = false;
|
52 |
|
|
|
53 |
|
|
--
|
54 |
2138
|
aaronmk
|
-- Name: _toBool; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
55 |
2107
|
aaronmk
|
--
|
56 |
|
|
|
57 |
2138
|
aaronmk
|
CREATE TABLE "_toBool" (
|
58 |
|
|
result boolean,
|
59 |
2107
|
aaronmk
|
value text
|
60 |
|
|
);
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
--
|
64 |
2138
|
aaronmk
|
-- Name: _toDouble; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
65 |
2107
|
aaronmk
|
--
|
66 |
|
|
|
67 |
2138
|
aaronmk
|
CREATE TABLE "_toDouble" (
|
68 |
|
|
result double precision,
|
69 |
|
|
value text
|
70 |
|
|
);
|
71 |
2107
|
aaronmk
|
|
72 |
|
|
|
73 |
|
|
--
|
74 |
2138
|
aaronmk
|
-- Name: _toBool_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
75 |
2107
|
aaronmk
|
--
|
76 |
|
|
|
77 |
2138
|
aaronmk
|
CREATE UNIQUE INDEX "_toBool_unique" ON "_toBool" USING btree ((COALESCE(value, '\\N'::text)));
|
78 |
2107
|
aaronmk
|
|
79 |
|
|
|
80 |
|
|
--
|
81 |
2138
|
aaronmk
|
-- Name: _toDouble_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
82 |
2094
|
aaronmk
|
--
|
83 |
|
|
|
84 |
2138
|
aaronmk
|
CREATE UNIQUE INDEX "_toDouble_unique" ON "_toDouble" USING btree ((COALESCE(value, '\\N'::text)));
|
85 |
2136
|
aaronmk
|
|
86 |
|
|
|
87 |
|
|
--
|
88 |
2138
|
aaronmk
|
-- Name: _toBool; Type: TRIGGER; Schema: functions; Owner: -
|
89 |
2136
|
aaronmk
|
--
|
90 |
|
|
|
91 |
2138
|
aaronmk
|
CREATE TRIGGER "_toBool" BEFORE INSERT OR UPDATE ON "_toBool" FOR EACH ROW EXECUTE PROCEDURE "_toBool"();
|
92 |
2136
|
aaronmk
|
|
93 |
|
|
|
94 |
|
|
--
|
95 |
2138
|
aaronmk
|
-- Name: _toDouble; Type: TRIGGER; Schema: functions; Owner: -
|
96 |
2136
|
aaronmk
|
--
|
97 |
|
|
|
98 |
2138
|
aaronmk
|
CREATE TRIGGER "_toDouble" BEFORE INSERT OR UPDATE ON "_toDouble" FOR EACH ROW EXECUTE PROCEDURE "_toDouble"();
|
99 |
2136
|
aaronmk
|
|
100 |
|
|
|
101 |
|
|
--
|
102 |
|
|
-- PostgreSQL database dump complete
|
103 |
|
|
--
|