Commit 589dc00d authored by Alexander Barkov's avatar Alexander Barkov

Test for MDEV-11874 "Data too long for column" instead of "Invalid default...

Test for MDEV-11874 "Data too long for column" instead of "Invalid default value for" upon ALTER in strict mode

This problem was earlier fixed by the patch for:
    MDEV-16421 Make system tables crash safe

Adding tests only.
parent 81f6a3b0
......@@ -686,3 +686,40 @@ DROP TABLE t1,t2;
#
# End of 10.0 tests
#
#
# Start of 10.4 tests
#
SET sql_mode='';
CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
Warning 1265 Data truncated for column 'c' at row 1
Error 1067 Invalid default value for 'c'
SET sql_mode='STRICT_ALL_TABLES';
CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
Warning 1265 Data truncated for column 'c' at row 1
Error 1067 Invalid default value for 'c'
CREATE TABLE t1 (c VARCHAR(1));
SET sql_mode='';
ALTER TABLE t1 ALTER column c SET DEFAULT 'foo';
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
Warning 1265 Data truncated for column 'c' at row 1
Error 1067 Invalid default value for 'c'
SET sql_mode='STRICT_ALL_TABLES';
ALTER TABLE t1 ALTER column c SET DEFAULT 'foo';
ERROR 42000: Invalid default value for 'c'
SHOW WARNINGS;
Level Code Message
Warning 1265 Data truncated for column 'c' at row 1
Error 1067 Invalid default value for 'c'
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# End of 10.4 tests
#
......@@ -328,3 +328,34 @@ DROP TABLE t1,t2;
--echo #
--echo # End of 10.0 tests
--echo #
--echo #
--echo # Start of 10.4 tests
--echo #
SET sql_mode='';
--error ER_INVALID_DEFAULT
CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
SHOW WARNINGS;
SET sql_mode='STRICT_ALL_TABLES';
--error ER_INVALID_DEFAULT
CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
SHOW WARNINGS;
CREATE TABLE t1 (c VARCHAR(1));
SET sql_mode='';
--error ER_INVALID_DEFAULT
ALTER TABLE t1 ALTER column c SET DEFAULT 'foo';
SHOW WARNINGS;
SET sql_mode='STRICT_ALL_TABLES';
--error ER_INVALID_DEFAULT
ALTER TABLE t1 ALTER column c SET DEFAULT 'foo';
SHOW WARNINGS;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
--echo # End of 10.4 tests
--echo #
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