~drizzle-trunk/drizzle/development

813.1.20 by Jay Pipes
Fixes for the QUARTER() function to use new Temporal system and throw
1
SELECT QUARTER(NULL);
2
QUARTER(NULL)
3
NULL
4
SELECT QUARTER();
5
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ')' at line 1
6
SELECT QUARTER(1, 0);
7
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ' 0)' at line 1
8
SELECT QUARTER("xxx");
9
ERROR HY000: Received an invalid datetime value 'xxx'.
10
SELECT QUARTER("0000-00-00");
11
ERROR HY000: Received an invalid datetime value '0000-00-00'.
12
SELECT QUARTER("0000-01-01");
13
ERROR HY000: Received an invalid datetime value '0000-01-01'.
14
SELECT QUARTER("0001-00-01");
15
ERROR HY000: Received an invalid datetime value '0001-00-01'.
16
SELECT QUARTER("0001-01-00");
17
ERROR HY000: Received an invalid datetime value '0001-01-00'.
18
SELECT QUARTER("2000-02-30");
19
ERROR HY000: Received an invalid datetime value '2000-02-30'.
20
SELECT QUARTER("1900-02-29");
21
ERROR HY000: Received an invalid datetime value '1900-02-29'.
22
SELECT QUARTER('1976-15-15');
23
ERROR HY000: Received an invalid datetime value '1976-15-15'.
24
SELECT QUARTER("2009-01-12");
25
QUARTER("2009-01-12")
26
1
27
SELECT QUARTER("2009-04-22");
28
QUARTER("2009-04-22")
29
2
30
SELECT QUARTER("70-12-31");
31
QUARTER("70-12-31")
32
4
33
SELECT QUARTER("99-12-31");
34
QUARTER("99-12-31")
35
4
36
SELECT QUARTER("69-12-31");
37
QUARTER("69-12-31")
38
4
39
SELECT QUARTER("0001-12-31");
40
QUARTER("0001-12-31")
41
4
42
SELECT QUARTER("9999-12-31");
43
QUARTER("9999-12-31")
44
4
45
SELECT QUARTER('07/31/2009');
46
QUARTER('07/31/2009')
47
3
48
SELECT QUARTER('20090916');
49
QUARTER('20090916')
50
3
51
SELECT QUARTER('20090916091528');
52
QUARTER('20090916091528')
53
3
54
SELECT QUARTER("20090916091528.000000");
55
QUARTER("20090916091528.000000")
56
3
57
SELECT QUARTER('09-09-16');
58
QUARTER('09-09-16')
59
3
60
SELECT QUARTER('09.09.16');
61
QUARTER('09.09.16')
62
3
63
SELECT QUARTER('09/09/16');
64
QUARTER('09/09/16')
65
3
66
SELECT QUARTER('09-09-16');
67
QUARTER('09-09-16')
68
3
69
SELECT QUARTER('09-9-2');
70
QUARTER('09-9-2')
71
3
72
SELECT QUARTER(20090916);
73
QUARTER(20090916)
74
3
75
SELECT QUARTER(20090916091528);
76
QUARTER(20090916091528)
77
3
78
SELECT QUARTER(20090916091528.000001);
79
QUARTER(20090916091528.000001)
80
3
81
USE test;
82
DROP TABLE IF EXISTS t1;
83
CREATE TABLE t1 (
84
int_fld INT NOT NULL
85
, date_fld DATE NOT NULL
86
, datetime_fld DATETIME NOT NULL
87
, timestamp_fld TIMESTAMP NOT NULL
88
, char_fld CHAR(22) NOT NULL
89
, varchar_fld VARCHAR(22) NOT NULL
90
, text_fld TEXT NOT NULL
91
, blob_fld BLOB NOT NULL
92
);
93
INSERT INTO t1 VALUES (
94
20071130
95
, "2007-11-30"
96
, "2007-11-30 16:30:19"
97
, "2007-11-30T16:30:19"
98
, "2007-11-30 16:30:19"
99
, "2007-11-30 16:30:19"
100
, "2007-11-30T16:30:19"
101
, "2007-11-30T16:30:19"
102
);
103
SELECT QUARTER(int_fld) FROM t1;
104
QUARTER(int_fld)
105
4
106
SELECT QUARTER(date_fld) FROM t1;
107
QUARTER(date_fld)
108
4
109
SELECT QUARTER(datetime_fld) FROM t1;
110
QUARTER(datetime_fld)
111
4
112
SELECT QUARTER(timestamp_fld) FROM t1;
113
QUARTER(timestamp_fld)
114
4
115
SELECT QUARTER(char_fld) FROM t1;
116
QUARTER(char_fld)
117
4
118
SELECT QUARTER(varchar_fld) FROM t1;
119
QUARTER(varchar_fld)
120
4
121
SELECT QUARTER(text_fld) FROM t1;
122
QUARTER(text_fld)
123
4
124
SELECT QUARTER(blob_fld) FROM t1;
125
QUARTER(blob_fld)
126
4
127
DROP TABLE t1;