1
|
--
|
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
|
SET search_path = functions, pg_catalog;
|
20
|
|
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
|
BEGIN
|
30
|
new.result := CAST(new.value AS boolean);
|
31
|
EXCEPTION
|
32
|
WHEN data_exception THEN
|
33
|
new.result := NULL;
|
34
|
RAISE WARNING '%', SQLERRM;
|
35
|
END;
|
36
|
RETURN new;
|
37
|
END;
|
38
|
$$;
|
39
|
|
40
|
|
41
|
--
|
42
|
-- Name: _toDouble(); Type: FUNCTION; Schema: functions; Owner: -
|
43
|
--
|
44
|
|
45
|
CREATE FUNCTION "_toDouble"() RETURNS trigger
|
46
|
LANGUAGE plpgsql IMMUTABLE
|
47
|
AS $$
|
48
|
BEGIN
|
49
|
BEGIN
|
50
|
new.result := CAST(new.value AS double precision);
|
51
|
EXCEPTION
|
52
|
WHEN data_exception THEN
|
53
|
new.result := NULL;
|
54
|
RAISE WARNING '%', SQLERRM;
|
55
|
END;
|
56
|
RETURN new;
|
57
|
END;
|
58
|
$$;
|
59
|
|
60
|
|
61
|
--
|
62
|
-- Name: _toTimestamp(); Type: FUNCTION; Schema: functions; Owner: -
|
63
|
--
|
64
|
|
65
|
CREATE FUNCTION "_toTimestamp"() RETURNS trigger
|
66
|
LANGUAGE plpgsql IMMUTABLE
|
67
|
AS $$
|
68
|
BEGIN
|
69
|
BEGIN
|
70
|
new.result := CAST(new.value AS timestamp with time zone);
|
71
|
EXCEPTION
|
72
|
WHEN data_exception THEN
|
73
|
new.result := NULL;
|
74
|
RAISE WARNING '%', SQLERRM;
|
75
|
END;
|
76
|
RETURN new;
|
77
|
END;
|
78
|
$$;
|
79
|
|
80
|
|
81
|
SET default_tablespace = '';
|
82
|
|
83
|
SET default_with_oids = false;
|
84
|
|
85
|
--
|
86
|
-- Name: _toBool; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
87
|
--
|
88
|
|
89
|
CREATE TABLE "_toBool" (
|
90
|
result boolean,
|
91
|
not_null boolean DEFAULT true NOT NULL,
|
92
|
value text
|
93
|
);
|
94
|
|
95
|
|
96
|
--
|
97
|
-- Name: _toDouble; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
98
|
--
|
99
|
|
100
|
CREATE TABLE "_toDouble" (
|
101
|
result double precision,
|
102
|
not_null boolean DEFAULT true NOT NULL,
|
103
|
value text
|
104
|
);
|
105
|
|
106
|
|
107
|
--
|
108
|
-- Name: _toTimestamp; Type: TABLE; Schema: functions; Owner: -; Tablespace:
|
109
|
--
|
110
|
|
111
|
CREATE TABLE "_toTimestamp" (
|
112
|
result timestamp with time zone,
|
113
|
not_null boolean DEFAULT true NOT NULL,
|
114
|
value text
|
115
|
);
|
116
|
|
117
|
|
118
|
--
|
119
|
-- Name: _toBool_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
120
|
--
|
121
|
|
122
|
CREATE UNIQUE INDEX "_toBool_unique" ON "_toBool" USING btree ((COALESCE(value, '\\N'::text)));
|
123
|
|
124
|
|
125
|
--
|
126
|
-- Name: _toDouble_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
127
|
--
|
128
|
|
129
|
CREATE UNIQUE INDEX "_toDouble_unique" ON "_toDouble" USING btree ((COALESCE(value, '\\N'::text)));
|
130
|
|
131
|
|
132
|
--
|
133
|
-- Name: _toTimestamp_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace:
|
134
|
--
|
135
|
|
136
|
CREATE UNIQUE INDEX "_toTimestamp_unique" ON "_toTimestamp" USING btree ((COALESCE(value, '\\N'::text)));
|
137
|
|
138
|
|
139
|
--
|
140
|
-- Name: _toBool; Type: TRIGGER; Schema: functions; Owner: -
|
141
|
--
|
142
|
|
143
|
CREATE TRIGGER "_toBool" BEFORE INSERT OR UPDATE ON "_toBool" FOR EACH ROW EXECUTE PROCEDURE "_toBool"();
|
144
|
|
145
|
|
146
|
--
|
147
|
-- Name: _toDouble; Type: TRIGGER; Schema: functions; Owner: -
|
148
|
--
|
149
|
|
150
|
CREATE TRIGGER "_toDouble" BEFORE INSERT OR UPDATE ON "_toDouble" FOR EACH ROW EXECUTE PROCEDURE "_toDouble"();
|
151
|
|
152
|
|
153
|
--
|
154
|
-- Name: _toTimestamp; Type: TRIGGER; Schema: functions; Owner: -
|
155
|
--
|
156
|
|
157
|
CREATE TRIGGER "_toTimestamp" BEFORE INSERT OR UPDATE ON "_toTimestamp" FOR EACH ROW EXECUTE PROCEDURE "_toTimestamp"();
|
158
|
|
159
|
|
160
|
--
|
161
|
-- PostgreSQL database dump complete
|
162
|
--
|
163
|
|