1
by brian
clean slate |
1 |
drop table if exists t1, t2;
|
2 |
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
|
1812.4.2
by Brian Aker
Fix issue with divide by zero not being an error. |
3 |
ERROR 22012: Division by 0
|
1
by brian
clean slate |
4 |
explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
1812.4.2
by Brian Aker
Fix issue with divide by zero not being an error. |
5 |
ERROR 22012: Division by 0
|
685.4.1
by Jay Pipes
Enabled the null.test. |
6 |
select CONCAT(1, NULL),1+NULL,1-NULL;
|
7 |
CONCAT(1, NULL) 1+NULL 1-NULL
|
|
8 |
NULL NULL NULL
|
|
9 |
select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,CONCAT(IFNULL(NULL,1), 0);
|
|
10 |
NULL=NULL NULL<>NULL IFNULL(NULL,1.1)+0 CONCAT(IFNULL(NULL,1), 0)
|
|
11 |
NULL NULL 1.1 10
|
|
12 |
select strcmp("a",NULL),(1<NULL)+0.0,null like "a%","a%" like null;
|
|
13 |
strcmp("a",NULL) (1<NULL)+0.0 null like "a%" "a%" like null
|
|
1
by brian
clean slate |
14 |
NULL NULL NULL NULL
|
15 |
select concat("a",NULL),replace(NULL,"a","b"),replace("string","i",NULL),replace("string",NULL,"i"),insert("abc",1,1,NULL),left(NULL,1);
|
|
16 |
concat("a",NULL) replace(NULL,"a","b") replace("string","i",NULL) replace("string",NULL,"i") insert("abc",1,1,NULL) left(NULL,1)
|
|
17 |
NULL NULL NULL NULL NULL NULL
|
|
18 |
select repeat("a",0),repeat("ab",5+5),repeat("ab",-1),reverse(NULL);
|
|
19 |
repeat("a",0) repeat("ab",5+5) repeat("ab",-1) reverse(NULL)
|
|
20 |
abababababababababab NULL
|
|
21 |
select field(NULL,"a","b","c");
|
|
22 |
field(NULL,"a","b","c")
|
|
23 |
0
|
|
24 |
select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
|
25 |
2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
|
|
26 |
0 0 NULL NULL NULL
|
|
27 |
explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
|
28 |
id select_type table type possible_keys key key_len ref rows filtered Extra
|
|
29 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
30 |
Warnings:
|
|
31 |
Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
|
|
32 |
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
|
|
33 |
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
|
|
34 |
NULL NULL NULL NULL NULL NULL
|
|
35 |
SELECT (NULL OR NULL) IS NULL;
|
|
36 |
(NULL OR NULL) IS NULL
|
|
37 |
1
|
|
38 |
select NULL AND 0, 0 and NULL;
|
|
39 |
NULL AND 0 0 and NULL
|
|
40 |
0 0
|
|
41 |
create table t1 (x int);
|
|
42 |
insert into t1 values (null);
|
|
43 |
select * from t1 where x != 0;
|
|
44 |
x
|
|
45 |
drop table t1;
|
|
46 |
CREATE TABLE t1 (
|
|
47 |
indexed_field int default NULL,
|
|
48 |
KEY indexed_field (indexed_field)
|
|
49 |
);
|
|
50 |
INSERT INTO t1 VALUES (NULL),(NULL);
|
|
51 |
SELECT * FROM t1 WHERE indexed_field=NULL;
|
|
52 |
indexed_field
|
|
53 |
SELECT * FROM t1 WHERE indexed_field IS NULL;
|
|
54 |
indexed_field
|
|
55 |
NULL
|
|
56 |
NULL
|
|
57 |
SELECT * FROM t1 WHERE indexed_field<=>NULL;
|
|
58 |
indexed_field
|
|
59 |
NULL
|
|
60 |
NULL
|
|
61 |
DROP TABLE t1;
|
|
685.4.1
by Jay Pipes
Enabled the null.test. |
62 |
create table t1 (a int, b int);
|
1
by brian
clean slate |
63 |
insert into t1 values(20,null);
|
64 |
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
65 |
t2.b=t3.a;
|
|
66 |
b ifnull(t2.b,"this is null")
|
|
67 |
NULL this is null
|
|
68 |
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
69 |
t2.b=t3.a order by 1;
|
|
70 |
b ifnull(t2.b,"this is null")
|
|
71 |
NULL this is null
|
|
72 |
insert into t1 values(10,null);
|
|
73 |
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
74 |
t2.b=t3.a order by 1;
|
|
75 |
b ifnull(t2.b,"this is null")
|
|
76 |
NULL this is null
|
|
77 |
NULL this is null
|
|
78 |
drop table t1;
|
|
873.1.2
by Jay Pipes
Fixed Field_datetime to never accept any bad datetimes as a string. This broke |
79 |
CREATE TABLE t1 (a varchar(16) NOT NULL default '', b int NOT NULL default 0, c datetime NOT NULL default '2009-02-10 00:00:00', d int NOT NULL default 0);
|
1
by brian
clean slate |
80 |
INSERT INTO t1 (a) values (null);
|
81 |
ERROR 23000: Column 'a' cannot be null
|
|
82 |
INSERT INTO t1 (a) values (1/null);
|
|
83 |
ERROR 23000: Column 'a' cannot be null
|
|
84 |
INSERT INTO t1 (a) values (null),(null);
|
|
685.4.1
by Jay Pipes
Enabled the null.test. |
85 |
ERROR 23000: Column 'a' cannot be null
|
1
by brian
clean slate |
86 |
INSERT INTO t1 (b) values (null);
|
87 |
ERROR 23000: Column 'b' cannot be null
|
|
88 |
INSERT INTO t1 (b) values (1/null);
|
|
89 |
ERROR 23000: Column 'b' cannot be null
|
|
90 |
INSERT INTO t1 (b) values (null),(null);
|
|
685.4.1
by Jay Pipes
Enabled the null.test. |
91 |
ERROR 23000: Column 'b' cannot be null
|
1
by brian
clean slate |
92 |
INSERT INTO t1 (c) values (null);
|
93 |
ERROR 23000: Column 'c' cannot be null
|
|
94 |
INSERT INTO t1 (c) values (1/null);
|
|
95 |
ERROR 23000: Column 'c' cannot be null
|
|
96 |
INSERT INTO t1 (c) values (null),(null);
|
|
685.4.1
by Jay Pipes
Enabled the null.test. |
97 |
ERROR 23000: Column 'c' cannot be null
|
1
by brian
clean slate |
98 |
INSERT INTO t1 (d) values (null);
|
99 |
ERROR 23000: Column 'd' cannot be null
|
|
100 |
INSERT INTO t1 (d) values (1/null);
|
|
101 |
ERROR 23000: Column 'd' cannot be null
|
|
102 |
INSERT INTO t1 (d) values (null),(null);
|
|
685.4.1
by Jay Pipes
Enabled the null.test. |
103 |
ERROR 23000: Column 'd' cannot be null
|
104 |
UPDATE t1 SET d= NULL;
|
|
105 |
INSERT INTO t1 VALUES ();
|
|
106 |
UPDATE t1 SET a=1/NULL;
|
|
107 |
ERROR 23000: Column 'a' cannot be null
|
|
108 |
UPDATE t1 SET a=NULL;
|
|
109 |
ERROR 23000: Column 'a' cannot be null
|
|
110 |
UPDATE t1 SET b=NULL;
|
|
111 |
ERROR 23000: Column 'b' cannot be null
|
|
112 |
UPDATE t1 SET c=NULL;
|
|
113 |
ERROR 23000: Column 'c' cannot be null
|
|
114 |
UPDATE t1 SET d=NULL;
|
|
115 |
ERROR 23000: Column 'd' cannot be null
|
|
116 |
truncate table t1;
|
|
1786.3.2
by Monty Taylor
Cleaned up the initial pass at this. It's not perfect, but it does work. |
117 |
LOAD DATA INFILE '../../std_data_ln/null_test.txt' INTO TABLE t1 FIELDS ENCLOSED BY '"';
|
685.4.1
by Jay Pipes
Enabled the null.test. |
118 |
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'a' at row 1
|
1
by brian
clean slate |
119 |
drop table t1;
|
120 |
create table t1 (a int not null, b int not null, index idx(a));
|
|
121 |
insert into t1 values
|
|
122 |
(1,1), (2,2), (3,3), (4,4), (5,5), (6,6),
|
|
123 |
(7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
|
|
124 |
explain select * from t1 where a between 2 and 3;
|
|
125 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
1100.1.1
by Brian Aker
Disable MRR |
126 |
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
|
1
by brian
clean slate |
127 |
explain select * from t1 where a between 2 and 3 or b is null;
|
128 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
1100.1.1
by Brian Aker
Disable MRR |
129 |
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
|
685.4.1
by Jay Pipes
Enabled the null.test. |
130 |
drop table t1;
|
1
by brian
clean slate |
131 |
create table t1 select
|
132 |
null as c00,
|
|
133 |
if(1, null, 'string') as c01,
|
|
134 |
if(0, null, 'string') as c02,
|
|
135 |
ifnull(null, 'string') as c03,
|
|
136 |
ifnull('string', null) as c04,
|
|
137 |
case when 0 then null else 'string' end as c05,
|
|
138 |
case when 1 then null else 'string' end as c06,
|
|
139 |
coalesce(null, 'string') as c07,
|
|
140 |
coalesce('string', null) as c08,
|
|
141 |
least('string',null) as c09,
|
|
142 |
least(null, 'string') as c10,
|
|
143 |
greatest('string',null) as c11,
|
|
144 |
greatest(null, 'string') as c12,
|
|
145 |
nullif('string', null) as c13,
|
|
146 |
nullif(null, 'string') as c14,
|
|
147 |
trim('string' from null) as c15,
|
|
148 |
trim(null from 'string') as c16,
|
|
149 |
substring_index('string', null, 1) as c17,
|
|
150 |
substring_index(null, 'string', 1) as c18,
|
|
151 |
elt(1, null, 'string') as c19,
|
|
152 |
elt(1, 'string', null) as c20,
|
|
153 |
concat('string', null) as c21,
|
|
154 |
concat(null, 'string') as c22,
|
|
155 |
concat_ws('sep', 'string', null) as c23,
|
|
156 |
concat_ws('sep', null, 'string') as c24,
|
|
157 |
concat_ws(null, 'string', 'string') as c25,
|
|
158 |
make_set(3, 'string', null) as c26,
|
|
159 |
make_set(3, null, 'string') as c27,
|
|
160 |
export_set(3, null, 'off', 'sep') as c29,
|
|
161 |
export_set(3, 'on', null, 'sep') as c30,
|
|
162 |
export_set(3, 'on', 'off', null) as c31,
|
|
163 |
replace(null, 'from', 'to') as c32,
|
|
164 |
replace('str', null, 'to') as c33,
|
|
165 |
replace('str', 'from', null) as c34,
|
|
166 |
insert('str', 1, 2, null) as c35,
|
|
167 |
insert(null, 1, 2, 'str') as c36,
|
|
168 |
lpad('str', 10, null) as c37,
|
|
169 |
rpad(null, 10, 'str') as c38;
|
|
170 |
show create table t1;
|
|
171 |
Table Create Table
|
|
172 |
t1 CREATE TABLE `t1` (
|
|
1743.5.2
by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output |
173 |
`c00` VARBINARY(0) DEFAULT NULL,
|
174 |
`c01` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
175 |
`c02` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
176 |
`c03` VARCHAR(6) COLLATE utf8_general_ci NOT NULL,
|
|
177 |
`c04` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
178 |
`c05` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
179 |
`c06` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
180 |
`c07` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
181 |
`c08` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
182 |
`c09` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
183 |
`c10` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
184 |
`c11` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
185 |
`c12` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
186 |
`c13` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
187 |
`c14` VARCHAR(0) COLLATE utf8_general_ci DEFAULT NULL,
|
|
188 |
`c15` VARCHAR(0) COLLATE utf8_general_ci DEFAULT NULL,
|
|
189 |
`c16` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
190 |
`c17` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
191 |
`c18` VARCHAR(0) COLLATE utf8_general_ci DEFAULT NULL,
|
|
192 |
`c19` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
193 |
`c20` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
194 |
`c21` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
195 |
`c22` VARCHAR(6) COLLATE utf8_general_ci DEFAULT NULL,
|
|
196 |
`c23` VARCHAR(9) COLLATE utf8_general_ci DEFAULT NULL,
|
|
197 |
`c24` VARCHAR(9) COLLATE utf8_general_ci DEFAULT NULL,
|
|
198 |
`c25` VARCHAR(12) COLLATE utf8_general_ci DEFAULT NULL,
|
|
199 |
`c26` VARCHAR(7) COLLATE utf8_general_ci DEFAULT NULL,
|
|
200 |
`c27` VARCHAR(7) COLLATE utf8_general_ci DEFAULT NULL,
|
|
201 |
`c29` VARCHAR(381) COLLATE utf8_general_ci DEFAULT NULL,
|
|
202 |
`c30` VARCHAR(317) COLLATE utf8_general_ci DEFAULT NULL,
|
|
203 |
`c31` VARCHAR(192) COLLATE utf8_general_ci DEFAULT NULL,
|
|
204 |
`c32` VARCHAR(0) COLLATE utf8_general_ci DEFAULT NULL,
|
|
205 |
`c33` VARCHAR(3) COLLATE utf8_general_ci DEFAULT NULL,
|
|
206 |
`c34` VARCHAR(3) COLLATE utf8_general_ci DEFAULT NULL,
|
|
207 |
`c35` VARCHAR(3) COLLATE utf8_general_ci DEFAULT NULL,
|
|
208 |
`c36` VARCHAR(3) COLLATE utf8_general_ci DEFAULT NULL,
|
|
209 |
`c37` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
|
|
210 |
`c38` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
|
|
1638.10.82
by Stewart Smith
fix some tests for explicit COLLATE in CREATE TABLE |
211 |
) ENGINE=DEFAULT COLLATE = utf8_general_ci
|
1
by brian
clean slate |
212 |
drop table t1;
|
213 |
select
|
|
214 |
case 'str' when 'STR' then 'str' when null then 'null' end as c01,
|
|
215 |
case 'str' when null then 'null' when 'STR' then 'str' end as c02,
|
|
216 |
field(null, 'str1', 'str2') as c03,
|
|
217 |
field('str1','STR1', null) as c04,
|
|
218 |
field('str1', null, 'STR1') as c05,
|
|
219 |
'string' in ('STRING', null) as c08,
|
|
220 |
'string' in (null, 'STRING') as c09;
|
|
221 |
c01 c02 c03 c04 c05 c08 c09
|
|
222 |
str str 0 1 2 1 1
|
|
223 |
# End of 4.1 tests
|
|
224 |
#
|
|
225 |
# Bug #31471: decimal_bin_size: Assertion `scale >= 0 &&
|
|
226 |
# precision > 0 && scale <= precision'
|
|
227 |
#
|
|
685.4.1
by Jay Pipes
Enabled the null.test. |
228 |
CREATE TABLE t1 (a DECIMAL (1, 0) , b DECIMAL (1, 0) );
|
1
by brian
clean slate |
229 |
INSERT INTO t1 (a, b) VALUES (0, 0);
|
230 |
CREATE TABLE t2 SELECT IFNULL(a, b) FROM t1;
|
|
231 |
DESCRIBE t2;
|
|
1309.4.3
by Brian Aker
Refactor DESC to use new table. |
232 |
Field Type Null Default Default_is_NULL On_Update
|
1660
by Brian Aker
MErge in change to do YES/NO like standard requires. |
233 |
IFNULL(a, b) DECIMAL YES YES
|
1
by brian
clean slate |
234 |
DROP TABLE t2;
|
235 |
CREATE TABLE t2 SELECT IFNULL(a, NULL) FROM t1;
|
|
236 |
DESCRIBE t2;
|
|
1309.4.3
by Brian Aker
Refactor DESC to use new table. |
237 |
Field Type Null Default Default_is_NULL On_Update
|
1660
by Brian Aker
MErge in change to do YES/NO like standard requires. |
238 |
IFNULL(a, NULL) DECIMAL YES YES
|
1
by brian
clean slate |
239 |
DROP TABLE t2;
|
240 |
CREATE TABLE t2 SELECT IFNULL(NULL, b) FROM t1;
|
|
241 |
DESCRIBE t2;
|
|
1309.4.3
by Brian Aker
Refactor DESC to use new table. |
242 |
Field Type Null Default Default_is_NULL On_Update
|
1660
by Brian Aker
MErge in change to do YES/NO like standard requires. |
243 |
IFNULL(NULL, b) DECIMAL YES YES
|
1
by brian
clean slate |
244 |
DROP TABLE t1, t2;
|
245 |
# End of 5.0 tests
|