~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Testing of misc functions
3
#
4
5
--disable_warnings
6
DROP TABLE IF EXISTS t1, t2;
7
--enable_warnings
8
9
select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
10
11
select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
12
13
# As we can assume we are the only user for the mysqld server, the difference
14
# between two calls should be -1
15
set @a= uuid_short();
16
set @b= uuid_short();
17
select cast(@a - @b as signed);
18
19
#
20
# Test for core dump with nan
21
#
22
select length(format('nan', 2)) > 0;
23
24
#
25
# Test for bug #628
26
#
27
select concat("$",format(2500,2));
28
29
# Test for BUG#7716
30
create table t1 ( a timestamp );
31
insert into t1 values ( '2004-01-06 12:34' );
32
select a from t1 where left(a+0,6) in ( left(20040106,6) );
33
select a from t1 where left(a+0,6) = ( left(20040106,6) );
34
35
select a from t1 where right(a+0,6) in ( right(20040106123400,6) );
36
select a from t1 where right(a+0,6) = ( right(20040106123400,6) );
37
38
select a from t1 where mid(a+0,6,3) in ( mid(20040106123400,6,3) );
39
select a from t1 where mid(a+0,6,3) = ( mid(20040106123400,6,3) );
40
41
drop table t1;
42
43
44
#
45
# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
46
#
47
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
48
49
--echo End of 4.1 tests
50
51
52
#
53
# Test for BUG#9535
54
#
55
--disable_warnings
56
create table t1 as select uuid(), length(uuid());
57
--enable_warnings
58
show create table t1;
59
drop table t1;
60
61
#
62
# Bug #30832: Assertion + crash with select name_const('test',now());
63
#
64
--error ER_WRONG_ARGUMENTS
65
SELECT NAME_CONST('test', NOW());
66
--error ER_WRONG_ARGUMENTS
67
SELECT NAME_CONST('test', UPPER('test'));
68
69
SELECT NAME_CONST('test', NULL);
70
SELECT NAME_CONST('test', 1);
71
SELECT NAME_CONST('test', -1);
72
SELECT NAME_CONST('test', 1.0);
73
SELECT NAME_CONST('test', -1.0);
74
SELECT NAME_CONST('test', 'test');
75
76
#
77
# Bug #34749: Server crash when using NAME_CONST() with an aggregate function
78
#
79
80
CREATE TABLE t1 (a INT);
81
INSERT INTO t1 VALUES (1),(2),(3);
82
# NAME_CONST() + aggregate.
83
SELECT NAME_CONST('flag',1)    * MAX(a) FROM t1;
84
SELECT NAME_CONST('flag',1.5)  * MAX(a) FROM t1;
85
# Now, wrap the INT_ITEM in Item_func_neg and watch the pretty explosions
86
SELECT NAME_CONST('flag',-1)   * MAX(a) FROM t1;
87
SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
88
--error ER_WRONG_ARGUMENTS
89
SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
90
--error ER_WRONG_ARGUMENTS
91
SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
92
DROP TABLE t1;
93
94
#
95
# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter 
96
#             resolved against a column name of a derived table hangs the client
97
#
98
99
CREATE TABLE t1 (a int);
100
INSERT INTO t1 VALUES (5), (2);
101
102
--error ER_WRONG_ARGUMENTS
103
SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
104
105
DROP TABLE t1;
106
107
108
#
109
# Bug #32559: connection hangs on query with name_const
110
#
111
CREATE TABLE t1(a INT);
112
INSERT INTO t1 VALUES (), (), ();
113
--error ER_WRONG_ARGUMENTS
114
SELECT NAME_CONST(a, '1') FROM t1;
115
--error ER_WRONG_ARGUMENTS
116
SET INSERT_ID= NAME_CONST(a, a);
117
DROP TABLE t1;
118
119
#
120
# BUG#34289 - Incorrect NAME_CONST substitution in stored procedures breaks
121
# replication
122
#
123
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
124
125
--echo End of 5.0 tests
126
127
#
128
# Bug #30389: connection_id() always return 0 in embedded server
129
#
130
131
select connection_id() > 0;
132
133
--echo End of tests