~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1;
2
select floor(5.5),floor(-5.5);
3
floor(5.5)	floor(-5.5)
4
5	-6
5
explain extended select floor(5.5),floor(-5.5);
6
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
7
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
8
Warnings:
9
Note	1003	select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
10
select ceiling(5.5),ceiling(-5.5);
11
ceiling(5.5)	ceiling(-5.5)
12
6	-5
13
explain extended select ceiling(5.5),ceiling(-5.5);
14
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
15
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
16
Warnings:
17
Note	1003	select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
18
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
19
truncate(52.64,1)	truncate(52.64,2)	truncate(52.64,-1)	truncate(52.64,-2)	truncate(-52.64,1)	truncate(-52.64,-1)
20
52.6	52.64	50	0	-52.6	-50
21
explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
22
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
23
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
24
Warnings:
25
Note	1003	select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
26
select round(5.5),round(-5.5);
27
round(5.5)	round(-5.5)
28
6	-6
29
explain extended select round(5.5),round(-5.5);
30
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
31
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
32
Warnings:
33
Note	1003	select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
34
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
35
round(5.64,1)	round(5.64,2)	round(5.64,-1)	round(5.64,-2)
36
5.6	5.64	10	0
37
select abs(-10), sign(-5), sign(5), sign(0);
38
abs(-10)	sign(-5)	sign(5)	sign(0)
39
10	-1	1	0
40
explain extended select abs(-10), sign(-5), sign(5), sign(0);
41
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
42
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
43
Warnings:
44
Note	1003	select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
45
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
1812.4.2 by Brian Aker
Fix issue with divide by zero not being an error.
46
ERROR 22012: Division by 0
1 by brian
clean slate
47
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
48
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
49
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
50
Warnings:
51
Note	1003	select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
52
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
1812.4.2 by Brian Aker
Fix issue with divide by zero not being an error.
53
ERROR 22012: Division by 0
1 by brian
clean slate
54
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
55
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
56
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
57
Warnings:
58
Note	1003	select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
59
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
1812.4.2 by Brian Aker
Fix issue with divide by zero not being an error.
60
ERROR 22012: Division by 0
1 by brian
clean slate
61
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
62
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
63
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
64
Warnings:
65
Note	1003	select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
66
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
1812.4.2 by Brian Aker
Fix issue with divide by zero not being an error.
67
ERROR 22012: Division by 0
1 by brian
clean slate
68
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
69
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
70
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
71
Warnings:
72
Note	1003	select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
73
select pow(10,log10(10)),power(2,4);
74
pow(10,log10(10))	power(2,4)
75
10	16
76
explain extended select pow(10,log10(10)),power(2,4);
77
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
78
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
79
Warnings:
80
Note	1003	select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
81
select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
82
pi()	format(sin(pi()/2),6)	format(cos(pi()/2),6)	format(abs(tan(pi())),6)	format(cot(1),6)	format(asin(1),6)	format(acos(0),6)	format(atan(1),6)
397 by Brian Aker
Remove tiny/small int.
83
3.141593	1.000000	0.000000	0.000000	0.642093	1.570796	1.570796	0.785398
1 by brian
clean slate
84
explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
85
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
86
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
87
Warnings:
397 by Brian Aker
Remove tiny/small int.
88
Note	1003	select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
1 by brian
clean slate
89
select degrees(pi()),radians(360);
90
degrees(pi())	radians(360)
1108.5.2 by rm
fix test results so they expect valid precision, rather than more than can be relied upon
91
180	6.28318530717959
1 by brian
clean slate
92
select format(atan(-2, 2), 6);
93
format(atan(-2, 2), 6)
94
-0.785398
95
select format(atan(pi(), 0), 6);
96
format(atan(pi(), 0), 6)
97
1.570796
98
select format(atan2(-2, 2), 6);
99
format(atan2(-2, 2), 6)
100
-0.785398
101
select format(atan2(pi(), 0), 6);
102
format(atan2(pi(), 0), 6)
103
1.570796
104
SELECT ACOS(1.0);
105
ACOS(1.0)
106
0
107
SELECT ASIN(1.0);
108
ASIN(1.0)
1108.5.2 by rm
fix test results so they expect valid precision, rather than more than can be relied upon
109
1.5707963267949
1 by brian
clean slate
110
SELECT ACOS(0.2*5.0);
111
ACOS(0.2*5.0)
112
0
113
SELECT ACOS(0.5*2.0);
114
ACOS(0.5*2.0)
115
0
116
SELECT ASIN(0.8+0.2);
117
ASIN(0.8+0.2)
1108.5.2 by rm
fix test results so they expect valid precision, rather than more than can be relied upon
118
1.5707963267949
1 by brian
clean slate
119
SELECT ASIN(1.2-0.2);
120
ASIN(1.2-0.2)
1108.5.2 by rm
fix test results so they expect valid precision, rather than more than can be relied upon
121
1.5707963267949
1 by brian
clean slate
122
select format(4.55, 1), format(4.551, 1);
123
format(4.55, 1)	format(4.551, 1)
124
4.6	4.6
125
explain extended select degrees(pi()),radians(360);
126
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
127
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
128
Warnings:
129
Note	1003	select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
130
create table t1 (col1 int, col2 decimal(60,30));
131
insert into t1 values(1,1234567890.12345);
132
select format(col2,7) from t1;
133
format(col2,7)
134
1,234,567,890.1234500
135
select format(col2,8) from t1;
136
format(col2,8)
137
1,234,567,890.12345000
138
insert into t1 values(7,1234567890123456.12345);
139
select format(col2,6) from t1 where col1=7;
140
format(col2,6)
141
1,234,567,890,123,456.123450
142
drop table t1;
143
select ceil(0.09);
144
ceil(0.09)
145
1
146
select ceil(0.000000000000000009);
147
ceil(0.000000000000000009)
148
1
149
create table t1 select round(1, 6);
150
show create table t1;
151
Table	Create Table
152
t1	CREATE TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
153
  `round(1, 6)` INT NOT NULL
1638.10.72 by Stewart Smith
func_math.result with explicit COLLATE in SHOW CREATE TABLE
154
) ENGINE=X COLLATE = utf8_general_ci
1 by brian
clean slate
155
select * from t1;
156
round(1, 6)
157
1
158
drop table t1;
159
select abs(-2) * -2;
160
abs(-2) * -2
161
-4
162
select round(111,-10);
163
round(111,-10)
164
0
165
select round(-5000111000111000155,-1);
166
round(-5000111000111000155,-1)
167
-5000111000111000160
168
select round(15000111000111000155,-1);
169
round(15000111000111000155,-1)
170
15000111000111000160
171
select truncate(-5000111000111000155,-1);
172
truncate(-5000111000111000155,-1)
173
-5000111000111000150
174
select truncate(15000111000111000155,-1);
175
truncate(15000111000111000155,-1)
176
15000111000111000150
1063.9.3 by Brian Aker
Partial fix for tests for tmp
177
create TEMPORARY table t1
1 by brian
clean slate
178
(f1 varchar(32) not null,
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
179
f2 int not null,
180
f3 int not null default '0')
383.4.1 by Jay Pipes
Fixed syntax errors in func_math test and re-enable the test in the make test target
181
engine=myisam;
1 by brian
clean slate
182
insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
1063.9.3 by Brian Aker
Partial fix for tests for tmp
183
create TEMPORARY table t2
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
184
(f1 int not null,
185
f2 int not null,
186
f3 int not null)
383.4.1 by Jay Pipes
Fixed syntax errors in func_math test and re-enable the test in the make test target
187
engine=myisam;
1 by brian
clean slate
188
insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
189
select format(t2.f2-t2.f1+1,0) from t1,t2
190
where t1.f2 = t2.f3 order by t1.f1;
191
format(t2.f2-t2.f1+1,0)
192
10,000
193
10,000
194
drop table t1, t2;
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
195
select -2, 18446744073709551614, -2;
196
-2	18446744073709551614	-2
197
-2	18446744073709551614	-2
198
select abs(-2), abs(18446744073709551614), abs(-2);
199
abs(-2)	abs(18446744073709551614)	abs(-2)
200
2	18446744073709551614	2
201
select ceiling(-2), ceiling(18446744073709551614), ceiling(-2);
202
ceiling(-2)	ceiling(18446744073709551614)	ceiling(-2)
203
-2	18446744073709551614	-2
204
select floor(-2), floor(18446744073709551614), floor(-2);
205
floor(-2)	floor(18446744073709551614)	floor(-2)
206
-2	18446744073709551614	-2
207
select format(-2, 2), format(18446744073709551614, 2), format(-2, 2);
208
format(-2, 2)	format(18446744073709551614, 2)	format(-2, 2)
209
-2.00	18,446,744,073,709,551,614.00	-2.00
210
select sqrt(-2), sqrt(18446744073709551614), sqrt(-2);
211
sqrt(-2)	sqrt(18446744073709551614)	sqrt(-2)
212
NULL	4294967296	NULL
213
select round(-2, 1), round(18446744073709551614, 1), round(-2, 1);
214
round(-2, 1)	round(18446744073709551614, 1)	round(-2, 1)
215
-2	18446744073709551614	-2
216
select round(4, -2), round(4, 18446744073709551614), round(4, -2);
217
round(4, -2)	round(4, 18446744073709551614)	round(4, -2)
218
0	4	0
219
select truncate(-2, 1), truncate(18446744073709551614, 1), truncate(-2, 1);
220
truncate(-2, 1)	truncate(18446744073709551614, 1)	truncate(-2, 1)
221
-2	18446744073709551614	-2
222
select truncate(4, -2), truncate(4, 18446744073709551614), truncate(4, -2);
223
truncate(4, -2)	truncate(4, 18446744073709551614)	truncate(4, -2)
224
0	4	0
1 by brian
clean slate
225
select round(10000000000000000000, -19), truncate(10000000000000000000, -19);
226
round(10000000000000000000, -19)	truncate(10000000000000000000, -19)
227
10000000000000000000	10000000000000000000
228
select round(1e0, -309), truncate(1e0, -309);
229
round(1e0, -309)	truncate(1e0, -309)
230
0	0
231
select round(1e1,308), truncate(1e1, 308);
232
round(1e1,308)	truncate(1e1, 308)
233
10	10
234
select round(1e1, 2147483648), truncate(1e1, 2147483648);
235
round(1e1, 2147483648)	truncate(1e1, 2147483648)
236
10	10
237
select round(1.1e1, 4294967295), truncate(1.1e1, 4294967295);
238
round(1.1e1, 4294967295)	truncate(1.1e1, 4294967295)
239
11	11
240
select round(1.12e1, 4294967296), truncate(1.12e1, 4294967296);
241
round(1.12e1, 4294967296)	truncate(1.12e1, 4294967296)
242
11.2	11.2
243
select round(1.5, 2147483640), truncate(1.5, 2147483640);
244
round(1.5, 2147483640)	truncate(1.5, 2147483640)
245
1.500000000000000000000000000000	1.500000000000000000000000000000
246
select round(1.5, -2147483649), round(1.5, 2147483648);
247
round(1.5, -2147483649)	round(1.5, 2147483648)
248
0	1.500000000000000000000000000000
249
select truncate(1.5, -2147483649), truncate(1.5, 2147483648);
250
truncate(1.5, -2147483649)	truncate(1.5, 2147483648)
251
0	1.500000000000000000000000000000
252
select round(1.5, -4294967296), round(1.5, 4294967296);
253
round(1.5, -4294967296)	round(1.5, 4294967296)
254
0	1.500000000000000000000000000000
255
select truncate(1.5, -4294967296), truncate(1.5, 4294967296);
256
truncate(1.5, -4294967296)	truncate(1.5, 4294967296)
257
0	1.500000000000000000000000000000
258
select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
259
round(1.5, -9223372036854775808)	round(1.5, 9223372036854775808)
383.4.1 by Jay Pipes
Fixed syntax errors in func_math test and re-enable the test in the make test target
260
0	2.000000000000000000000000000000
1 by brian
clean slate
261
select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
262
truncate(1.5, -9223372036854775808)	truncate(1.5, 9223372036854775808)
383.4.1 by Jay Pipes
Fixed syntax errors in func_math test and re-enable the test in the make test target
263
0	1.000000000000000000000000000000
1 by brian
clean slate
264
select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
265
round(1.5, 18446744073709551615)	truncate(1.5, 18446744073709551615)
383.4.1 by Jay Pipes
Fixed syntax errors in func_math test and re-enable the test in the make test target
266
0.000000000000000000000000000000	0.000000000000000000000000000000
1 by brian
clean slate
267
select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
268
round(18446744073709551614, -1)	truncate(18446744073709551614, -1)
269
18446744073709551610	18446744073709551610
270
select round(4, -4294967200), truncate(4, -4294967200);
271
round(4, -4294967200)	truncate(4, -4294967200)
272
0	0
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
273
select mod(-2, 3), mod(18446744073709551614, 3), mod(-2, 3);
274
mod(-2, 3)	mod(18446744073709551614, 3)	mod(-2, 3)
275
-2	2	-2
276
select mod(5, -2), mod(5, 18446744073709551614), mod(5, -2);
277
mod(5, -2)	mod(5, 18446744073709551614)	mod(5, -2)
278
1	5	1
279
select pow(-2, 5), pow(18446744073709551614, 5), pow(-2, 5);
280
pow(-2, 5)	pow(18446744073709551614, 5)	pow(-2, 5)
281
-32	2.13598703592091e96	-32
397 by Brian Aker
Remove tiny/small int.
282
CREATE TABLE t1 (a timestamp, b varchar(20), c int);
1 by brian
clean slate
283
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
284
SELECT a DIV 900 y FROM t1 GROUP BY y;
285
y
286
22201025555
287
22255916666
288
SELECT DISTINCT a DIV 900 y FROM t1;
289
y
290
22201025555
291
22255916666
292
SELECT b DIV 900 y FROM t1 GROUP BY y;
293
y
294
0
295
SELECT c DIV 900 y FROM t1 GROUP BY y;
296
y
297
0
298
DROP TABLE t1;
299
CREATE TABLE t1(a LONGBLOB);
300
INSERT INTO t1 VALUES('1'),('2'),('3');
301
SELECT DISTINCT (a DIV 254576881) FROM t1;
302
(a DIV 254576881)
303
0
304
SELECT (a DIV 254576881) FROM t1 UNION ALL 
305
SELECT (a DIV 254576881) FROM t1;
306
(a DIV 254576881)
307
0
308
0
309
0
310
0
311
0
312
0
313
DROP TABLE t1;
314
End of 5.0 tests
315
SELECT 1e308 + 1e308;
316
1e308 + 1e308
317
NULL
318
SELECT -1e308 - 1e308;
319
-1e308 - 1e308
320
NULL
321
SELECT 1e300 * 1e300;
322
1e300 * 1e300
323
NULL
324
SELECT 1e300 / 1e-300;
325
1e300 / 1e-300
326
NULL
327
SELECT EXP(750);
328
EXP(750)
329
NULL
330
SELECT POW(10, 309);
331
POW(10, 309)
332
NULL
333
End of 5.1 tests