1
by brian
clean slate |
1 |
#
|
2 |
# Testing if SET and similar functions |
|
3 |
#
|
|
4 |
||
5 |
select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0; |
|
6 |
explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0; |
|
7 |
# Test 8 and 9 values (Bug #1561) |
|
8 |
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); |
|
9 |
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77); |
|
10 |
||
11 |
select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd"); |
|
12 |
select find_in_set("d","a,b,c"),find_in_set("dd","a,bbb,d"),find_in_set("bb","a,bbb,dd"); |
|
13 |
select make_set(0,'a','b','c'),make_set(-1,'a','b','c'),make_set(1,'a','b','c'),make_set(2,'a','b','c'),make_set(1+2,concat('a','b'),'c'); |
|
14 |
select make_set(NULL,'a','b','c'),make_set(1|4,'a',NULL,'c'),make_set(1+2,'a',NULL,'c'); |
|
15 |
select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N",""); |
|
16 |
||
17 |
#
|
|
18 |
# Wrong usage of functions |
|
19 |
#
|
|
20 |
select elt(2,1),field(NULL,"a","b","c"); |
|
21 |
select field("b","a",NULL),field(1,0,NULL)+0,field(1.0,0.0,NULL)+0.0,field(1.0e1,0.0e1,NULL)+0.0e1; |
|
22 |
select field(NULL,"a",NULL),field(NULL,0,NULL)+0,field(NULL,0.0,NULL)+0.0,field(NULL,0.0e1,NULL)+0.0e1; |
|
23 |
select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); |
|
24 |
select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); |
|
25 |
select interval(null, 1, 10, 100); |
|
26 |
||
27 |
#
|
|
28 |
# test for a bug with elt() |
|
29 |
#
|
|
30 |
||
31 |
--disable_warnings
|
|
32 |
drop table if exists t1,t2; |
|
33 |
--enable_warnings
|
|
34 |
||
35 |
create table t1 (id int(10) not null unique); |
|
36 |
create table t2 (id int(10) not null primary key, val int(10) not null); |
|
37 |
insert into t1 values (1),(2),(4); |
|
38 |
insert into t2 values (1,1),(2,1),(3,1),(4,2); |
|
39 |
||
40 |
select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; |
|
41 |
select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; |
|
42 |
drop table t1,t2; |
|
43 |
||
44 |
#
|
|
45 |
# Bug4340: find_in_set is case insensitive even on binary operators |
|
46 |
#
|
|
47 |
||
48 |
select find_in_set(binary 'a',binary 'A,B,C'); |
|
49 |
select find_in_set('a',binary 'A,B,C'); |
|
50 |
select find_in_set(binary 'a', 'A,B,C'); |
|
51 |
||
52 |
#
|
|
53 |
# Bug5513:FIND_IN_SET fails if set ends with a comma |
|
54 |
#
|
|
55 |
select find_in_set('1','3,1,'); |
|
56 |
||
57 |
--echo End of 4.1 tests
|
|
58 |
||
59 |
#
|
|
60 |
# Bug #32560: crash with interval function and count(*) |
|
61 |
#
|
|
62 |
SELECT INTERVAL(0.0, NULL); |
|
63 |
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL)); |
|
64 |
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL)); |
|
65 |
SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
|
66 |
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), |
|
67 |
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), |
|
68 |
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL)); |
|
69 |
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL), |
|
70 |
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL), |
|
71 |
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL), |
|
72 |
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL)); |
|
73 |
||
74 |
--echo End of 5.0 tests
|