aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/library/yql/tests/sql/suites/datetime/date_cast.sql
blob: 0cea9766c7ad3596799ddd3446a47f1a54f301de (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* postgres can not */
select cast(Yql::Date(AsAtom("1")) as Uint8);
select cast(Yql::Date(AsAtom("1")) as Uint32);
select cast(Yql::Date(AsAtom("1")) as Int32);
select cast(Yql::Date(AsAtom("1")) as Uint64);
select cast(Yql::Date(AsAtom("1")) as Int64);

select cast(Yql::Datetime(AsAtom("1")) as Uint8);
select cast(Yql::Datetime(AsAtom("1")) as Uint32);
select cast(Yql::Datetime(AsAtom("1")) as Int32);
select cast(Yql::Datetime(AsAtom("1")) as Uint64);
select cast(Yql::Datetime(AsAtom("1")) as Int64);

select cast(Yql::Timestamp(AsAtom("1")) as Uint8);
select cast(Yql::Timestamp(AsAtom("1")) as Uint32);
select cast(Yql::Timestamp(AsAtom("1")) as Int32);
select cast(Yql::Timestamp(AsAtom("1")) as Uint64);
select cast(Yql::Timestamp(AsAtom("1")) as Int64);

select cast(Yql::Interval(AsAtom("1")) as Uint8);
select cast(Yql::Interval(AsAtom("1")) as Uint32);
select cast(Yql::Interval(AsAtom("1")) as Int32);
select cast(Yql::Interval(AsAtom("1")) as Uint64);
select cast(Yql::Interval(AsAtom("1")) as Int64);

select cast(1ut as Date);
select cast(1u as Date);
select cast(1 as Date);
select cast(1ul as Date);
select cast(1l as Date);
select cast(-1 as Date);
select cast(1/1 as Date);
select cast(-1/1 as Date);
/* postgres can not */
select cast(Yql::Date(AsAtom("1")) as Uint8);
select cast(Yql::Date(AsAtom("1")) as Uint32);
select cast(Yql::Date(AsAtom("1")) as Int32);
select cast(Yql::Date(AsAtom("1")) as Uint64);
select cast(Yql::Date(AsAtom("1")) as Int64);

select cast(Yql::Datetime(AsAtom("1")) as Uint8);
select cast(Yql::Datetime(AsAtom("1")) as Uint32);
select cast(Yql::Datetime(AsAtom("1")) as Int32);
select cast(Yql::Datetime(AsAtom("1")) as Uint64);
select cast(Yql::Datetime(AsAtom("1")) as Int64);

select cast(Yql::Timestamp(AsAtom("1")) as Uint8);
select cast(Yql::Timestamp(AsAtom("1")) as Uint32);
select cast(Yql::Timestamp(AsAtom("1")) as Int32);
select cast(Yql::Timestamp(AsAtom("1")) as Uint64);
select cast(Yql::Timestamp(AsAtom("1")) as Int64);

select cast(Yql::Interval(AsAtom("1")) as Uint8);
select cast(Yql::Interval(AsAtom("1")) as Uint32);
select cast(Yql::Interval(AsAtom("1")) as Int32);
select cast(Yql::Interval(AsAtom("1")) as Uint64);
select cast(Yql::Interval(AsAtom("1")) as Int64);

select cast(1ut as Date);
select cast(1u as Date);
select cast(1 as Date);
select cast(1ul as Date);
select cast(1l as Date);
select cast(-1 as Date);
select cast(1/1 as Date);
select cast(-1/1 as Date);
select cast(1/0 as Date);

select cast(1ut as Datetime);
select cast(1u as Datetime);
select cast(1 as Datetime);
select cast(1ul as Datetime);
select cast(1l as Datetime);
select cast(-1 as Datetime);
select cast(1/1 as Datetime);
select cast(-1/1 as Datetime);
select cast(1/0 as Datetime);

select cast(1ut as Timestamp);
select cast(1u as Timestamp);
select cast(1 as Timestamp);
select cast(1ul as Timestamp);
select cast(1l as Timestamp);
select cast(-1 as Timestamp);
select cast(1/1 as Timestamp);
select cast(-1/1 as Timestamp);
select cast(1/0 as Timestamp);

select cast(1ut as Interval);
select cast(1u as Interval);
select cast(-1 as Interval);
select cast(1ul as Interval);
select cast(-1l as Interval);
select cast(-1 as Interval);
select cast(1/1 as Interval);
select cast(-1/1 as Interval);
select cast(1/0 as Interval);