-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdb2fce--0.0.9--0.0.10.sql
35 lines (30 loc) · 1.38 KB
/
db2fce--0.0.9--0.0.10.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
CREATE OR REPLACE FUNCTION db2.date(value timestamp)
RETURNS date
AS $$ SELECT cast(date_trunc('day', $1) as date); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION db2.date(timestamp) IS 'Returns the date part of a timestamp';
CREATE OR REPLACE FUNCTION db2.date(value timestamp with time zone)
RETURNS date
AS $$ SELECT cast(date_trunc('day', $1) as date); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION db2.date(timestamp with time zone) IS 'Returns the date part of a timestamp';
CREATE OR REPLACE FUNCTION db2.date(value text)
RETURNS date
AS $$ SELECT cast(date_trunc('day', $1::timestamp) as date); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION db2.date(text) IS 'Returns the date part of a timestamp';
CREATE OR REPLACE FUNCTION db2.time(value timestamp)
RETURNS time
AS $$ SELECT cast($1 as time); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION db2.time(timestamp) IS 'Returns the time part of a timestamp';
CREATE OR REPLACE FUNCTION db2.time(value timestamp with time zone)
RETURNS time
AS $$ SELECT cast($1 as time); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION db2.time(timestamp with time zone) IS 'Returns the time part of a timestamp';
CREATE OR REPLACE FUNCTION db2.time(value text)
RETURNS time
AS $$ SELECT cast($1::timestamp as time); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION db2.time(text) IS 'Returns the time part of a timestamp';