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