Commit c7cf529f authored by unknown's avatar unknown

Fixed bug in strict mode (A state was not properly cleared on successful insert/update's)


mysql-test/mysql-test-run.sh:
  Print less text on failure
mysql-test/r/strict.result:
  More tests for strict mode
mysql-test/t/strict.test:
  More tests for strict mode
sql/set_var.cc:
  Don't clear any flags in traditional mode
sql/sql_insert.cc:
  Fixed bug in strict mode
sql/sql_update.cc:
  Fixed bug in strict mode
parent 6966e869
...@@ -1184,17 +1184,19 @@ stop_master () ...@@ -1184,17 +1184,19 @@ stop_master ()
mysql_stop () mysql_stop ()
{ {
$ECHO "Ending Tests" if [ "$MASTER_RUNNING" = 1 ]
$ECHO "Shutting-down MySQL daemon" then
$ECHO "" $ECHO "Ending Tests"
stop_master $ECHO "Shutting-down MySQL daemon"
$ECHO "Master shutdown finished" $ECHO ""
stop_slave stop_master
stop_slave 1 $ECHO "Master shutdown finished"
stop_slave 2 stop_slave
$ECHO "Slave shutdown finished" stop_slave 1
stop_slave 2
return 1 $ECHO "Slave shutdown finished"
fi
return 1
} }
mysql_restart () mysql_restart ()
...@@ -1383,8 +1385,6 @@ run_testcase () ...@@ -1383,8 +1385,6 @@ run_testcase ()
then then
mysql_restart mysql_restart
fi fi
$ECHO "Resuming Tests"
$ECHO ""
fi fi
fi fi
fi fi
......
...@@ -26,14 +26,20 @@ ERROR 22007: Incorrect date value: '59' for column 'col1' at row 1 ...@@ -26,14 +26,20 @@ ERROR 22007: Incorrect date value: '59' for column 'col1' at row 1
set @@sql_mode='STRICT_ALL_TABLES'; set @@sql_mode='STRICT_ALL_TABLES';
INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31'); INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31');
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE'; set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
INSERT INTO t1 VALUES('2004-0-31'); INSERT INTO t1 VALUES('2004-0-30');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-0-30' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05'); INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 2 ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 2
INSERT INTO t1 VALUES('0000-00-00'); INSERT INTO t1 VALUES('0000-00-00');
INSERT IGNORE INTO t1 VALUES('2004-0-29');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE'; set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
INSERT INTO t1 VALUES('0000-00-00'); INSERT INTO t1 VALUES('0000-00-00');
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT IGNORE INTO t1 VALUES('0000-00-00');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT INTO t1 VALUES ('2004-0-30'); INSERT INTO t1 VALUES ('2004-0-30');
INSERT INTO t1 VALUES ('2004-2-30'); INSERT INTO t1 VALUES ('2004-2-30');
ERROR 22007: Incorrect date value: '2004-2-30' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-2-30' for column 'col1' at row 1
...@@ -54,6 +60,8 @@ col1 ...@@ -54,6 +60,8 @@ col1
2004-00-31 2004-00-31
2004-01-04 2004-01-04
0000-00-00 0000-00-00
0000-00-00
0000-00-00
2004-00-30 2004-00-30
2004-02-30 2004-02-30
2004-02-29 2004-02-29
...@@ -188,6 +196,13 @@ col1 ...@@ -188,6 +196,13 @@ col1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED); CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0); INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
MOD(col1,0)
NULL
NULL
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
INSERT INTO t1 (col1) VALUES(-129); INSERT INTO t1 (col1) VALUES(-129);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1 ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(128); INSERT INTO t1 (col1) VALUES(128);
...@@ -210,14 +225,30 @@ INSERT INTO t1 (col2) VALUES(-1.0); ...@@ -210,14 +225,30 @@ INSERT INTO t1 (col2) VALUES(-1.0);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1 ERROR 22003: Out of range value adjusted for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(256.0); INSERT INTO t1 (col2) VALUES(256.0);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1 ERROR 22003: Out of range value adjusted for column 'col2' at row 1
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1;
MOD(col1,0)
NULL
Warnings:
Error 1365 Division by 0
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
ERROR 22003: Out of range value adjusted for column 'col1' at row 1 ERROR 22003: Out of range value adjusted for column 'col1' at row 1
UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0; UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0;
ERROR 22003: Out of range value adjusted for column 'col2' at row 3 ERROR 22003: Out of range value adjusted for column 'col2' at row 3
UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
ERROR 22012: Division by 0 INSERT INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
set @@sql_mode='ansi,traditional';
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
MOD(col1,0)
NULL
NULL
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1 ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b'); INSERT INTO t1 (col1) VALUES ('a59b');
...@@ -231,6 +262,9 @@ INSERT IGNORE INTO t1 values (1/0,1/0); ...@@ -231,6 +262,9 @@ INSERT IGNORE INTO t1 values (1/0,1/0);
Warnings: Warnings:
Error 1365 Division by 0 Error 1365 Division by 0
Error 1365 Division by 0 Error 1365 Division by 0
set @@sql_mode='ansi';
INSERT INTO t1 values (1/0,1/0);
set @@sql_mode='ansi,traditional';
INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256'); INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256');
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'col1' at row 1 Warning 1264 Out of range value adjusted for column 'col1' at row 1
...@@ -255,8 +289,10 @@ col1 col2 ...@@ -255,8 +289,10 @@ col1 col2
-128 0 -128 0
0 NULL 0 NULL
127 255 127 255
NULL NULL
2 NULL 2 NULL
NULL NULL NULL NULL
NULL NULL
-128 0 -128 0
127 255 127 255
-128 0 -128 0
...@@ -294,7 +330,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0; ...@@ -294,7 +330,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
ERROR 22003: Out of range value adjusted for column 'col2' at row 3 ERROR 22003: Out of range value adjusted for column 'col2' at row 3
UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1 ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1
...@@ -378,7 +414,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0; ...@@ -378,7 +414,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
ERROR 22003: Out of range value adjusted for column 'col2' at row 3 ERROR 22003: Out of range value adjusted for column 'col2' at row 3
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1 ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1
...@@ -462,7 +498,7 @@ UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0; ...@@ -462,7 +498,7 @@ UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0;
ERROR 22003: Out of range value adjusted for column 'col2' at row 3 ERROR 22003: Out of range value adjusted for column 'col2' at row 3
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1 ERROR 22003: Out of range value adjusted for column 'col1' at row 1
...@@ -541,7 +577,7 @@ INSERT INTO t1 (col2) VALUES(18446744073709551616.0); ...@@ -541,7 +577,7 @@ INSERT INTO t1 (col2) VALUES(18446744073709551616.0);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1 ERROR 22003: Out of range value adjusted for column 'col2' at row 1
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1 ERROR 22003: Out of range value adjusted for column 'col1' at row 1
...@@ -621,7 +657,7 @@ UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11; ...@@ -621,7 +657,7 @@ UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
ERROR 22003: Out of range value adjusted for column 'col1' at row 6 ERROR 22003: Out of range value adjusted for column 'col1' at row 6
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1 ERROR 01000: Data truncated for column 'col1' at row 1
...@@ -692,7 +728,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; ...@@ -692,7 +728,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
ERROR 22003: Out of range value adjusted for column 'col1' at row 2 ERROR 22003: Out of range value adjusted for column 'col1' at row 2
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1 ERROR 01000: Data truncated for column 'col1' at row 1
...@@ -742,7 +778,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; ...@@ -742,7 +778,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
ERROR 22003: Out of range value adjusted for column 'col1' at row 2 ERROR 22003: Out of range value adjusted for column 'col1' at row 2
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1 ERROR 01000: Data truncated for column 'col1' at row 1
......
...@@ -38,13 +38,15 @@ set @@sql_mode='STRICT_ALL_TABLES'; ...@@ -38,13 +38,15 @@ set @@sql_mode='STRICT_ALL_TABLES';
INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31'); INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31');
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE'; set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
--error 1292 --error 1292
INSERT INTO t1 VALUES('2004-0-31'); INSERT INTO t1 VALUES('2004-0-30');
--error 1292 --error 1292
INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05'); INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05');
INSERT INTO t1 VALUES('0000-00-00'); INSERT INTO t1 VALUES('0000-00-00');
INSERT IGNORE INTO t1 VALUES('2004-0-29');
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE'; set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
--error 1292 --error 1292
INSERT INTO t1 VALUES('0000-00-00'); INSERT INTO t1 VALUES('0000-00-00');
INSERT IGNORE INTO t1 VALUES('0000-00-00');
INSERT INTO t1 VALUES ('2004-0-30'); INSERT INTO t1 VALUES ('2004-0-30');
--error 1292 --error 1292
INSERT INTO t1 VALUES ('2004-2-30'); INSERT INTO t1 VALUES ('2004-2-30');
...@@ -165,6 +167,8 @@ DROP TABLE t1; ...@@ -165,6 +167,8 @@ DROP TABLE t1;
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED); CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0); INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
# Test that we restored the mode checking properly after an ok query
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
-- error 1264 -- error 1264
INSERT INTO t1 (col1) VALUES(-129); INSERT INTO t1 (col1) VALUES(-129);
-- error 1264 -- error 1264
...@@ -187,14 +191,17 @@ INSERT INTO t1 (col1) VALUES(128.0); ...@@ -187,14 +191,17 @@ INSERT INTO t1 (col1) VALUES(128.0);
INSERT INTO t1 (col2) VALUES(-1.0); INSERT INTO t1 (col2) VALUES(-1.0);
-- error 1264 -- error 1264
INSERT INTO t1 (col2) VALUES(256.0); INSERT INTO t1 (col2) VALUES(256.0);
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1;
--error 1264 --error 1264
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
--error 1264 --error 1264
UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0; UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0;
--error 1365 --error 1365
UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0;
--error 1365 set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
SELECT MOD(col1,0) FROM t1; INSERT INTO t1 values (1/0,1/0);
set @@sql_mode='ansi,traditional';
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
# Should return SQLSTATE 22018 invalid character value for cast # Should return SQLSTATE 22018 invalid character value for cast
--error 1366 --error 1366
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
...@@ -204,6 +211,9 @@ INSERT INTO t1 (col1) VALUES ('a59b'); ...@@ -204,6 +211,9 @@ INSERT INTO t1 (col1) VALUES ('a59b');
INSERT INTO t1 (col1) VALUES ('1a'); INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 values (1/0,1/0); INSERT IGNORE INTO t1 values (1/0,1/0);
set @@sql_mode='ansi';
INSERT INTO t1 values (1/0,1/0);
set @@sql_mode='ansi,traditional';
INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256'); INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256');
INSERT IGNORE INTO t1 VALUES(-129.0,-1.0),(128.0,256.0); INSERT IGNORE INTO t1 VALUES(-129.0,-1.0),(128.0,256.0);
UPDATE IGNORE t1 SET col2=1/NULL where col1=0; UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
...@@ -247,7 +257,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0; ...@@ -247,7 +257,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
--error 1365 --error 1365
UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
--error 1366 --error 1366
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1366 --error 1366
...@@ -300,7 +310,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0; ...@@ -300,7 +310,7 @@ UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
--error 1365 --error 1365
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
--error 1366 --error 1366
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1366 --error 1366
...@@ -353,7 +363,7 @@ UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0; ...@@ -353,7 +363,7 @@ UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0;
--error 1365 --error 1365
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
--error 1264 --error 1264
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1264 --error 1264
...@@ -411,7 +421,7 @@ INSERT INTO t1 (col2) VALUES(18446744073709551616.0); ...@@ -411,7 +421,7 @@ INSERT INTO t1 (col2) VALUES(18446744073709551616.0);
--error 1365 --error 1365
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
--error 1264 --error 1264
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1264 --error 1264
...@@ -461,7 +471,7 @@ UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11; ...@@ -461,7 +471,7 @@ UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
--error 1365 --error 1365
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
--error 1265 --error 1265
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1265 --error 1265
...@@ -497,7 +507,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; ...@@ -497,7 +507,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
--error 1365 --error 1365
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
--error 1265 --error 1265
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1265 --error 1265
...@@ -531,7 +541,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; ...@@ -531,7 +541,7 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
--error 1365 --error 1365
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365 --error 1365
SELECT MOD(col1,0) FROM t1; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
--error 1265 --error 1265
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1265 --error 1265
......
...@@ -3102,12 +3102,9 @@ ulong fix_sql_mode(ulong sql_mode) ...@@ -3102,12 +3102,9 @@ ulong fix_sql_mode(ulong sql_mode)
if (sql_mode & MODE_MYSQL323) if (sql_mode & MODE_MYSQL323)
sql_mode|= MODE_NO_FIELD_OPTIONS; sql_mode|= MODE_NO_FIELD_OPTIONS;
if (sql_mode & MODE_TRADITIONAL) if (sql_mode & MODE_TRADITIONAL)
{
sql_mode|= (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES | sql_mode|= (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES |
MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_ERROR_FOR_DIVISION_BY_ZERO); MODE_ERROR_FOR_DIVISION_BY_ZERO);
sql_mode&= ~MODE_INVALID_DATES;
}
return sql_mode; return sql_mode;
} }
......
...@@ -453,6 +453,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -453,6 +453,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
} }
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0; table->insert_values=0;
thd->abort_on_warning= 0;
DBUG_RETURN(0); DBUG_RETURN(0);
abort: abort:
......
...@@ -457,6 +457,7 @@ int mysql_update(THD *thd, ...@@ -457,6 +457,7 @@ int mysql_update(THD *thd,
DBUG_PRINT("info",("%d records updated",updated)); DBUG_PRINT("info",("%d records updated",updated));
} }
thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
thd->abort_on_warning= 0;
free_io_cache(table); free_io_cache(table);
DBUG_RETURN(0); DBUG_RETURN(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment