1
by brian
clean slate |
1 |
# Testing of "strict" mode |
2 |
||
3 |
-- source include/have_innodb.inc
|
|
4 |
||
5 |
# Test INSERT with INT |
|
6 |
||
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
7 |
--disable_warnings
|
8 |
DROP TABLE IF EXISTS t1; |
|
9 |
--enable_warnings
|
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
10 |
CREATE TABLE t1 (col1 INT); |
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
11 |
INSERT INTO t1 VALUES(-2147483648); |
12 |
INSERT INTO t1 VALUES (0); |
|
13 |
INSERT INTO t1 VALUES (2147483647); |
|
14 |
INSERT INTO t1 VALUES ('-2147483648'); |
|
15 |
INSERT INTO t1 VALUES ('2147483647'); |
|
16 |
INSERT INTO t1 VALUES (-2147483648.0); |
|
17 |
INSERT INTO t1 VALUES (2147483647.0); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
18 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
19 |
INSERT INTO t1 (col1) VALUES(-2147483649); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
20 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
21 |
INSERT INTO t1 (col1) VALUES(2147643648); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
22 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
23 |
INSERT INTO t1 (col1) VALUES('-2147483649'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
24 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
25 |
INSERT INTO t1 (col1) VALUES('2147643648'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
26 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
27 |
INSERT INTO t1 (col1) VALUES(-2147483649.0); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
28 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
29 |
INSERT INTO t1 (col1) VALUES(2147643648.0); |
30 |
||
784.2.1
by Stewart Smith
fix strict test for drizzle. |
31 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
32 |
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
33 |
--error ER_DIVISION_BY_ZERO
|
1
by brian
clean slate |
34 |
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
35 |
--error ER_DIVISION_BY_ZERO
|
1
by brian
clean slate |
36 |
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
37 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
38 |
INSERT INTO t1 (col1) VALUES (''); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
39 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
40 |
INSERT INTO t1 (col1) VALUES ('a59b'); |
41 |
--error 1265
|
|
42 |
INSERT INTO t1 (col1) VALUES ('1a'); |
|
43 |
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
44 |
INSERT IGNORE INTO t1 values (1/0); |
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
45 |
INSERT IGNORE INTO t1 values (-2147483649); |
46 |
INSERT IGNORE INTO t1 values (2147643648); |
|
47 |
INSERT IGNORE INTO t1 values ('-2147483649'); |
|
48 |
INSERT IGNORE INTO t1 values ('2147643648'); |
|
49 |
INSERT IGNORE INTO t1 values (-2147483649.0); |
|
50 |
INSERT IGNORE INTO t1 values (2147643648.0); |
|
1
by brian
clean slate |
51 |
SELECT * FROM t1; |
52 |
DROP TABLE t1; |
|
53 |
||
54 |
# Test INSERT with BIGINT |
|
55 |
# Note that this doesn't behave 100 % to standard as we rotate |
|
56 |
# integers when it's too big/small (just like C) |
|
57 |
||
784.2.1
by Stewart Smith
fix strict test for drizzle. |
58 |
CREATE TABLE t1 (col1 BIGINT); |
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
59 |
INSERT INTO t1 VALUES (-9223372036854775808); |
60 |
INSERT INTO t1 VALUES (0); |
|
61 |
INSERT INTO t1 VALUES (9223372036854775807); |
|
62 |
INSERT INTO t1 VALUES ('-9223372036854775808'); |
|
63 |
INSERT INTO t1 VALUES ('9223372036854775807'); |
|
64 |
INSERT INTO t1 VALUES (-9223372036854774000.0); |
|
65 |
INSERT INTO t1 VALUES (9223372036854775700.0); |
|
1
by brian
clean slate |
66 |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
67 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
68 |
INSERT INTO t1 (col1) VALUES(-9223372036854775809); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
69 |
# DISABLED due to https://bugs.launchpad.net/drizzle/+bug/316221 |
70 |
# --error ER_WARN_DATA_OUT_OF_RANGE |
|
71 |
# INSERT INTO t1 (col1) VALUES(9223372036854775808); |
|
1
by brian
clean slate |
72 |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
73 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
74 |
INSERT INTO t1 (col1) VALUES('-9223372036854775809'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
75 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
76 |
INSERT INTO t1 (col1) VALUES('9223372036854775808'); |
77 |
||
78 |
# Note that the following two double numbers are slighty bigger than max/min |
|
79 |
# bigint becasue of rounding errors when converting it to bigint |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
80 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
81 |
INSERT INTO t1 (col1) VALUES(-9223372036854785809.0); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
82 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
83 |
INSERT INTO t1 (col1) VALUES(9223372036854785808.0); |
84 |
||
85 |
# The following doesn't give an error as it's done in integer context |
|
86 |
# UPDATE t1 SET col1=col1 - 5000 WHERE col1 < 0; |
|
87 |
# UPDATE t1 SET col2 =col2 + 5000 WHERE col2 > 0; |
|
88 |
||
784.2.1
by Stewart Smith
fix strict test for drizzle. |
89 |
--error ER_DIVISION_BY_ZERO
|
1
by brian
clean slate |
90 |
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
91 |
--error ER_DIVISION_BY_ZERO
|
1
by brian
clean slate |
92 |
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
93 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
94 |
INSERT INTO t1 (col1) VALUES (''); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
95 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
96 |
INSERT INTO t1 (col1) VALUES ('a59b'); |
97 |
--error 1265
|
|
98 |
INSERT INTO t1 (col1) VALUES ('1a'); |
|
99 |
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
100 |
INSERT IGNORE INTO t1 values (1/0); |
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
101 |
INSERT IGNORE INTO t1 VALUES (-9223372036854775809); |
102 |
INSERT IGNORE INTO t1 VALUES (9223372036854775808); |
|
103 |
INSERT IGNORE INTO t1 VALUES ('-9223372036854775809'); |
|
104 |
INSERT IGNORE INTO t1 VALUES ('9223372036854775808'); |
|
105 |
INSERT IGNORE INTO t1 VALUES (-9223372036854785809.0); |
|
106 |
INSERT IGNORE INTO t1 VALUES (9223372036854785808.0); |
|
1
by brian
clean slate |
107 |
SELECT * FROM t1; |
108 |
DROP TABLE t1; |
|
109 |
||
110 |
# Test INSERT with NUMERIC |
|
111 |
||
112 |
CREATE TABLE t1 (col1 NUMERIC(4,2)); |
|
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
113 |
# The following INSERT statements used to look as follows before |
114 |
# the fix for bug#337038 was implemented: |
|
115 |
# INSERT INTO t1 |
|
116 |
# VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01); |
|
117 |
# Now that decimal truncation gives an error instead of a warning, we will |
|
118 |
# get an error on certain INSERT statements below about decimal truncation. |
|
119 |
||
120 |
INSERT INTO t1 VALUES (10.55); |
|
121 |
# this statement errors due to decimal truncation. The number |
|
122 |
# used in insertion is chosen to test that this this error does |
|
123 |
# in fact occur |
|
124 |
--error 1265
|
|
125 |
INSERT INTO t1 VALUES (10.5555); |
|
126 |
INSERT INTO t1 VALUES (0); |
|
127 |
INSERT INTO t1 VALUES (-10.55); |
|
128 |
# this statement errors due to decimal truncation. The number |
|
129 |
# used in insertion is chosen to test that this this error does |
|
130 |
# in fact occur |
|
131 |
--error 1265
|
|
132 |
INSERT INTO t1 VALUES (-10.5555); |
|
133 |
INSERT INTO t1 VALUES (11); |
|
134 |
INSERT INTO t1 VALUES (1e+01); |
|
135 |
||
136 |
# The following INSERT statements used to look as follows before |
|
137 |
# the fix for bug#337038 was implemented: |
|
138 |
# INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01'); |
|
139 |
# Now that decimal truncation gives an error instead of a warning, we will |
|
140 |
# get an error on certain INSERT statements below about decimal truncation. |
|
141 |
||
142 |
INSERT INTO t1 VALUES ('10.55'); |
|
143 |
# this statement errors due to decimal truncation. The number |
|
144 |
# used in insertion is chosen to test that this this error does |
|
145 |
# in fact occur |
|
146 |
--error 1265
|
|
147 |
INSERT INTO t1 VALUES ('10.5555'); |
|
148 |
INSERT INTO t1 VALUES ('-10.55'); |
|
149 |
# this statement errors due to decimal truncation. The number |
|
150 |
# used in insertion is chosen to test that this error does |
|
151 |
# in fact occur |
|
152 |
--error 1265
|
|
153 |
INSERT INTO t1 VALUES ('-10.5555'); |
|
154 |
INSERT INTO t1 VALUES ('11'); |
|
155 |
INSERT INTO t1 VALUES ('1e+01'); |
|
1
by brian
clean slate |
156 |
|
157 |
# The 2 following inserts should generate a warning, but doesn't yet |
|
158 |
# because NUMERIC works like DECIMAL
|
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
159 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
160 |
INSERT INTO t1 VALUES (101.55);
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
161 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
162 |
INSERT INTO t1 VALUES (101);
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
163 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
164 |
INSERT INTO t1 VALUES (-101.55);
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
165 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
166 |
INSERT INTO t1 VALUES (1010.55);
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
167 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
168 |
INSERT INTO t1 VALUES (1010);
|
169 |
# The 2 following inserts should generate a warning, but doesn't yet |
|
170 |
# because NUMERIC works like DECIMAL |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
171 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
172 |
INSERT INTO t1 VALUES ('101.55'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
173 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
174 |
INSERT INTO t1 VALUES ('101'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
175 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
176 |
INSERT INTO t1 VALUES ('-101.55'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
177 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
178 |
INSERT INTO t1 VALUES ('-1010.55'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
179 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
180 |
INSERT INTO t1 VALUES ('-100E+1'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
181 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
182 |
INSERT INTO t1 VALUES ('-100E'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
183 |
--error ER_WARN_DATA_OUT_OF_RANGE
|
1
by brian
clean slate |
184 |
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
185 |
--error ER_DIVISION_BY_ZERO
|
1
by brian
clean slate |
186 |
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
187 |
--error ER_DIVISION_BY_ZERO
|
1
by brian
clean slate |
188 |
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; |
189 |
#--error 1265 |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
190 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
191 |
INSERT INTO t1 (col1) VALUES (''); |
192 |
#--error 1265 |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
193 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
194 |
INSERT INTO t1 (col1) VALUES ('a59b'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
195 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
196 |
INSERT INTO t1 (col1) VALUES ('1a'); |
197 |
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); |
|
198 |
INSERT IGNORE INTO t1 values (1/0); |
|
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
199 |
INSERT IGNORE INTO t1 VALUES (1000); |
200 |
INSERT IGNORE INTO t1 VALUES (-1000); |
|
201 |
INSERT IGNORE INTO t1 VALUES ('1000'); |
|
202 |
INSERT IGNORE INTO t1 VALUES ('-1000'); |
|
203 |
INSERT IGNORE INTO t1 VALUES (1000.0); |
|
204 |
INSERT IGNORE INTO t1 VALUES (-1000.0); |
|
1
by brian
clean slate |
205 |
UPDATE IGNORE t1 SET col1=1/NULL where col1=0; |
942.3.1
by Vladimir Kolesnikov
test generalizations |
206 |
--sorted_result
|
1
by brian
clean slate |
207 |
SELECT * FROM t1; |
208 |
DROP TABLE t1; |
|
209 |
||
210 |
# Testing INSERT with CHAR/VARCHAR |
|
211 |
||
212 |
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6)); |
|
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
213 |
INSERT INTO t1 VALUES ('hello', 'hello'); |
214 |
INSERT INTO t1 VALUES ('he', 'he'); |
|
1637
by Brian Aker
Merge in changes to call error on bad data input. |
215 |
--error 1406
|
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
216 |
INSERT INTO t1 VALUES ('hello ', 'hello '); |
1
by brian
clean slate |
217 |
--error 1406
|
218 |
INSERT INTO t1 (col1) VALUES ('hellobob'); |
|
219 |
--error 1406
|
|
220 |
INSERT INTO t1 (col2) VALUES ('hellobob'); |
|
1637
by Brian Aker
Merge in changes to call error on bad data input. |
221 |
--error 1406
|
1
by brian
clean slate |
222 |
INSERT INTO t1 (col2) VALUES ('hello '); |
223 |
--error 1406
|
|
224 |
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he'; |
|
225 |
--error 1406
|
|
226 |
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he'; |
|
227 |
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob'); |
|
228 |
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he'; |
|
942.3.1
by Vladimir Kolesnikov
test generalizations |
229 |
--sorted_result
|
1
by brian
clean slate |
230 |
SELECT * FROM t1; |
231 |
DROP TABLE t1; |
|
232 |
||
233 |
# Testing INSERT with ENUM |
|
234 |
||
235 |
CREATE TABLE t1 (col1 enum('red','blue','green')); |
|
970.2.5
by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug |
236 |
INSERT INTO t1 VALUES ('red'); |
237 |
INSERT INTO t1 VALUES ('blue'); |
|
238 |
INSERT INTO t1 VALUES ('green'); |
|
934.4.1
by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not |
239 |
--error 1691 # Bad enum
|
1
by brian
clean slate |
240 |
INSERT INTO t1 (col1) VALUES ('yellow'); |
934.4.1
by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not |
241 |
--error 1691 # Bad enum
|
1
by brian
clean slate |
242 |
INSERT INTO t1 (col1) VALUES ('redd'); |
934.4.1
by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not |
243 |
--error 1691 # Bad enum
|
1
by brian
clean slate |
244 |
INSERT INTO t1 VALUES (''); |
934.4.1
by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not |
245 |
--error 1691 # Bad enum
|
1
by brian
clean slate |
246 |
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green'; |
934.4.1
by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not |
247 |
--error 1691 # Bad enum
|
1
by brian
clean slate |
248 |
INSERT IGNORE INTO t1 VALUES ('yellow'); |
934.4.1
by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not |
249 |
--error 1691 # Bad enum
|
1
by brian
clean slate |
250 |
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue'; |
251 |
SELECT * FROM t1; |
|
252 |
DROP TABLE t1; |
|
253 |
||
254 |
# Testing of insert of NULL in not NULL column |
|
255 |
||
256 |
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL); |
|
257 |
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20'); |
|
258 |
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21'); |
|
259 |
--error 1048
|
|
260 |
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01'); |
|
261 |
--error 1048
|
|
262 |
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01'); |
|
263 |
--error 1048
|
|
264 |
INSERT INTO t1 VALUES (103,'',NULL); |
|
265 |
--error 1048
|
|
266 |
UPDATE t1 SET col1=NULL WHERE col1 =100; |
|
267 |
--error 1048
|
|
268 |
UPDATE t1 SET col2 =NULL WHERE col2 ='hello'; |
|
269 |
--error 1048
|
|
270 |
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL; |
|
271 |
INSERT IGNORE INTO t1 values (NULL,NULL,NULL); |
|
272 |
SELECT * FROM t1; |
|
273 |
DROP TABLE t1; |
|
274 |
||
275 |
# Testing of default values |
|
276 |
||
277 |
CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL); |
|
942.3.1
by Vladimir Kolesnikov
test generalizations |
278 |
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
|
1
by brian
clean slate |
279 |
SHOW CREATE TABLE t1; |
280 |
INSERT INTO t1 VALUES (1, 'hello'); |
|
281 |
INSERT INTO t1 (col2) VALUES ('hello2'); |
|
282 |
--error 1048
|
|
283 |
INSERT INTO t1 (col2) VALUES (NULL); |
|
284 |
--error 1364
|
|
285 |
INSERT INTO t1 (col1) VALUES (2); |
|
286 |
--error 1364
|
|
287 |
INSERT INTO t1 VALUES(default(col1),default(col2)); |
|
288 |
--error 1364
|
|
289 |
INSERT INTO t1 (col1) SELECT 1; |
|
290 |
--error 1048
|
|
291 |
INSERT INTO t1 SELECT 1,NULL; |
|
292 |
INSERT IGNORE INTO t1 values (NULL,NULL); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
293 |
--error ER_NO_DEFAULT_FOR_FIELD
|
1
by brian
clean slate |
294 |
INSERT IGNORE INTO t1 (col1) values (3); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
295 |
--error ER_NO_DEFAULT_FOR_FIELD
|
1
by brian
clean slate |
296 |
INSERT IGNORE INTO t1 () values (); |
297 |
SELECT * FROM t1; |
|
298 |
DROP TABLE t1; |
|
299 |
||
300 |
#
|
|
301 |
# Bug #9029 Traditional: Wrong SQLSTATE returned for string truncation |
|
302 |
#
|
|
303 |
||
304 |
create table t1 (charcol char(255), varcharcol varchar(255), |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
305 |
varbinarycol varbinary(255)); |
1
by brian
clean slate |
306 |
--error 1406
|
307 |
insert into t1 (charcol) values (repeat('x',256)); |
|
308 |
--error 1406
|
|
309 |
insert into t1 (varcharcol) values (repeat('x',256)); |
|
310 |
--error 1406
|
|
311 |
insert into t1 (varbinarycol) values (repeat('x',256)); |
|
312 |
select * from t1; |
|
313 |
drop table t1; |
|
314 |
||
315 |
#
|
|
316 |
# Check insert with wrong CAST() (Bug #5912) |
|
317 |
#
|
|
318 |
||
319 |
create table t1 (col1 char(3), col2 integer); |
|
320 |
--error 1292
|
|
321 |
insert into t1 (col1) values (cast(1000 as char(3))); |
|
322 |
--error 1292
|
|
323 |
insert into t1 (col1) values (cast(1000E+0 as char(3))); |
|
324 |
--error 1292
|
|
325 |
insert into t1 (col1) values (cast(1000.0 as char(3))); |
|
326 |
--error 1292
|
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
327 |
insert into t1 (col2) values (cast('abc' as DECIMAL)); |
1
by brian
clean slate |
328 |
--error 1292
|
329 |
insert into t1 (col2) values (10E+0 + 'a'); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
330 |
--error 1265
|
331 |
insert into t1 (col2) values ('10a'); |
|
332 |
insert into t1 (col2) values (cast('10a' as DECIMAL)); |
|
333 |
insert into t1 (col2) values (cast('10' as DECIMAL)); |
|
334 |
insert into t1 (col2) values (cast('10' as DECIMAL)); |
|
1
by brian
clean slate |
335 |
insert into t1 (col2) values (10E+0 + '0 '); |
336 |
select * from t1; |
|
337 |
drop table t1; |
|
338 |
||
339 |
# Test fields with no default value that are NOT NULL (Bug #5986) |
|
340 |
CREATE TABLE t1 (i int not null); |
|
341 |
--error 1364
|
|
342 |
INSERT INTO t1 VALUES (); |
|
343 |
--error 1364
|
|
344 |
INSERT INTO t1 VALUES (DEFAULT); |
|
345 |
--error 1364
|
|
346 |
INSERT INTO t1 VALUES (DEFAULT(i)); |
|
347 |
ALTER TABLE t1 ADD j int; |
|
348 |
--error 1364
|
|
349 |
INSERT INTO t1 SET j = 1; |
|
350 |
--error 1364
|
|
351 |
INSERT INTO t1 SET j = 1, i = DEFAULT; |
|
352 |
--error 1364
|
|
353 |
INSERT INTO t1 SET j = 1, i = DEFAULT(i); |
|
354 |
--error 1364
|
|
355 |
INSERT INTO t1 VALUES (DEFAULT,1); |
|
356 |
DROP TABLE t1; |
|
357 |
CREATE TABLE t1 (i int not null); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
358 |
--error 1364
|
1
by brian
clean slate |
359 |
INSERT INTO t1 VALUES (); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
360 |
--error 1364
|
1
by brian
clean slate |
361 |
INSERT INTO t1 VALUES (DEFAULT); |
362 |
# DEFAULT(i) is an error even with the default sql_mode |
|
363 |
--error 1364
|
|
364 |
INSERT INTO t1 VALUES (DEFAULT(i)); |
|
365 |
ALTER TABLE t1 ADD j int; |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
366 |
--error 1364
|
1
by brian
clean slate |
367 |
INSERT INTO t1 SET j = 1; |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
368 |
--error 1364
|
1
by brian
clean slate |
369 |
INSERT INTO t1 SET j = 1, i = DEFAULT; |
370 |
--error 1364
|
|
371 |
INSERT INTO t1 SET j = 1, i = DEFAULT(i); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
372 |
--error 1364
|
1
by brian
clean slate |
373 |
INSERT INTO t1 VALUES (DEFAULT,1); |
374 |
DROP TABLE t1; |
|
375 |
||
376 |
#
|
|
377 |
# Bugs #8295 and #8296: varchar and varbinary conversion |
|
378 |
#
|
|
379 |
||
380 |
--error 1074
|
|
381 |
create table t1(a varchar(65537)); |
|
382 |
--error 1074
|
|
383 |
create table t1(a varbinary(65537)); |
|
384 |
||
385 |
#
|
|
386 |
# Bug #9881: problem with altering table |
|
387 |
#
|
|
388 |
||
389 |
create table t1(a int, b date not null); |
|
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
390 |
alter table t1 modify a bigint not null; |
942.3.1
by Vladimir Kolesnikov
test generalizations |
391 |
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
|
1
by brian
clean slate |
392 |
show create table t1; |
393 |
drop table t1; |
|
394 |
||
395 |
#
|
|
396 |
# Bug #11964: alter table with timestamp field |
|
397 |
#
|
|
398 |
||
399 |
create table t1(a int, b timestamp); |
|
400 |
alter table t1 add primary key(a); |
|
942.3.1
by Vladimir Kolesnikov
test generalizations |
401 |
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
|
1
by brian
clean slate |
402 |
show create table t1; |
403 |
drop table t1; |
|
404 |
create table t1(a int, b timestamp default 20050102030405); |
|
405 |
alter table t1 add primary key(a); |
|
942.3.1
by Vladimir Kolesnikov
test generalizations |
406 |
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
|
1
by brian
clean slate |
407 |
show create table t1; |
408 |
drop table t1; |
|
409 |
||
410 |
||
411 |
#
|
|
412 |
# Bug#17626 CREATE TABLE ... SELECT failure with TRADITIONAL SQL mode |
|
413 |
#
|
|
414 |
create table t1 (date date not null); |
|
415 |
create table t2 select date from t1; |
|
942.3.1
by Vladimir Kolesnikov
test generalizations |
416 |
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
|
1
by brian
clean slate |
417 |
show create table t2; |
418 |
drop table t2,t1; |
|
419 |
||
420 |
create table t1 (i int) |
|
1245.3.4
by Stewart Smith
make the equals of KEY=VALUE required for CREATE TABLE options |
421 |
comment='123456789*123456789*123456789*123456789*123456789*123456789*'; |
942.3.1
by Vladimir Kolesnikov
test generalizations |
422 |
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
|
1
by brian
clean slate |
423 |
show create table t1; |
424 |
drop table t1; |
|
425 |
||
426 |
#
|
|
427 |
# Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode |
|
428 |
#
|
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
429 |
|
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
430 |
create table t1(col1 int, col2 int, |
431 |
col3 int, col4 int, |
|
432 |
col7 int, col8 int, |
|
433 |
col9 bigint, col10 bigint); |
|
784.2.1
by Stewart Smith
fix strict test for drizzle. |
434 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
435 |
insert into t1(col1) values('-'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
436 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
437 |
insert into t1(col2) values('+'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
438 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
439 |
insert into t1(col3) values('-'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
440 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
441 |
insert into t1(col4) values('+'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
442 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
443 |
insert into t1(col7) values('-'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
444 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
445 |
insert into t1(col8) values('+'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
446 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
447 |
insert into t1(col9) values('-'); |
784.2.1
by Stewart Smith
fix strict test for drizzle. |
448 |
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
|
1
by brian
clean slate |
449 |
insert into t1(col10) values('+'); |
450 |
drop table t1; |
|
451 |
||
452 |
||
453 |
#
|
|
454 |
# Bug#27069 set with identical elements are created |
|
455 |
#
|
|
456 |
--error 1291
|
|
457 |
create table t1 (f1 enum('a','a')); |
|
458 |
||
459 |
--echo End of 5.0 tests
|