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