Revision 2249
Added by Aaron Marcuse-Kubitza over 12 years ago
schemas/functions.sql | ||
---|---|---|
46 | 46 |
$$; |
47 | 47 |
|
48 | 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 |
|
|
49 | 63 |
SET default_tablespace = ''; |
50 | 64 |
|
51 | 65 |
SET default_with_oids = false; |
... | ... | |
71 | 85 |
|
72 | 86 |
|
73 | 87 |
-- |
88 |
-- 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 |
-- |
|
74 | 98 |
-- Name: _toBool_unique; Type: INDEX; Schema: functions; Owner: -; Tablespace: |
75 | 99 |
-- |
76 | 100 |
|
... | ... | |
85 | 109 |
|
86 | 110 |
|
87 | 111 |
-- |
112 |
-- 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 |
-- |
|
88 | 119 |
-- Name: _toBool; Type: TRIGGER; Schema: functions; Owner: - |
89 | 120 |
-- |
90 | 121 |
|
... | ... | |
99 | 130 |
|
100 | 131 |
|
101 | 132 |
-- |
133 |
-- 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 |
-- |
|
102 | 140 |
-- PostgreSQL database dump complete |
103 | 141 |
-- |
104 | 142 |
|
Also available in: Unified diff
schemas/functions.sql: Added _toTimestamp