diff --git a/mysql-test/suite/tokudb.change_column/r/change_int.result b/mysql-test/suite/tokudb.change_column/r/change_int.result new file mode 100644 index 00000000000..f0b23a269e0 --- /dev/null +++ b/mysql-test/suite/tokudb.change_column/r/change_int.result @@ -0,0 +1,368 @@ +DROP TABLE IF EXISTS t; +SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB"; +SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1; +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT; +SELECT * FROM t; +a +-128 +-1 +0 +1 +127 +DROP TABLE t; +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +a +-128 +-1 +0 +1 +127 +DROP TABLE t; +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +a +-128 +-1 +0 +1 +127 +DROP TABLE t; +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +a +-128 +-1 +0 +1 +127 +DROP TABLE t; +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +a +-128 +-1 +0 +1 +127 +DROP TABLE t; +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-32768 +-1 +0 +1 +32767 +DROP TABLE t; +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +a +-32768 +-1 +0 +1 +32767 +DROP TABLE t; +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +a +-32768 +-1 +0 +1 +32767 +DROP TABLE t; +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +a +-32768 +-1 +0 +1 +32767 +DROP TABLE t; +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +a +-32768 +-1 +0 +1 +32767 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-8388608 +-1 +0 +1 +8388607 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-8388608 +-1 +0 +1 +8388607 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +a +-8388608 +-1 +0 +1 +8388607 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +a +-8388608 +-1 +0 +1 +8388607 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +a +-8388608 +-1 +0 +1 +8388607 +DROP TABLE t; +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-2147483648 +0 +1 +2147483647 +DROP TABLE t; +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-2147483648 +0 +1 +2147483647 +DROP TABLE t; +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-2147483648 +0 +1 +2147483647 +DROP TABLE t; +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +a +-2147483648 +0 +1 +2147483647 +DROP TABLE t; +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +a +-2147483648 +0 +1 +2147483647 +DROP TABLE t; +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-9223372036854775808 +0 +1 +9223372036854775807 +DROP TABLE t; +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-9223372036854775808 +0 +1 +9223372036854775807 +DROP TABLE t; +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-9223372036854775808 +0 +1 +9223372036854775807 +DROP TABLE t; +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +ALTER TABLE t CHANGE COLUMN a a INT; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +-9223372036854775808 +0 +1 +9223372036854775807 +DROP TABLE t; +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +a +-9223372036854775808 +0 +1 +9223372036854775807 +DROP TABLE t; diff --git a/mysql-test/suite/tokudb.change_column/r/change_uint.result b/mysql-test/suite/tokudb.change_column/r/change_uint.result new file mode 100644 index 00000000000..a504549b239 --- /dev/null +++ b/mysql-test/suite/tokudb.change_column/r/change_uint.result @@ -0,0 +1,288 @@ +DROP TABLE IF EXISTS t; +SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB"; +SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1; +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +255 +DROP TABLE t; +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +255 +DROP TABLE t; +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +255 +DROP TABLE t; +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +a +0 +1 +255 +DROP TABLE t; +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +255 +DROP TABLE t; +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +65535 +DROP TABLE t; +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +65535 +DROP TABLE t; +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +65535 +DROP TABLE t; +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +a +0 +1 +65535 +DROP TABLE t; +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +65535 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +16777215 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +16777215 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +16777215 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +a +0 +1 +16777215 +DROP TABLE t; +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +16777215 +DROP TABLE t; +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +4294967295 +DROP TABLE t; +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +4294967295 +DROP TABLE t; +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +4294967295 +DROP TABLE t; +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +a +0 +1 +4294967295 +DROP TABLE t; +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +4294967295 +DROP TABLE t; +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +18446744073709551615 +DROP TABLE t; +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +18446744073709551615 +DROP TABLE t; +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +18446744073709551615 +DROP TABLE t; +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version +SELECT * FROM t; +a +0 +1 +18446744073709551615 +DROP TABLE t; +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +a +0 +1 +18446744073709551615 +DROP TABLE t; diff --git a/mysql-test/suite/tokudb.change_column/t/change_int.py b/mysql-test/suite/tokudb.change_column/t/change_int.py new file mode 100644 index 00000000000..d27a68077f6 --- /dev/null +++ b/mysql-test/suite/tokudb.change_column/t/change_int.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# generate alter table test cases for integer types + +import sys +def gen_matrix(types, values): + print "# this test is generated by change_int.py" + print "--disable_warnings" + print "DROP TABLE IF EXISTS t;" + print "--enable_warnings" + print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";" + print "SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;" + for a in range(len(types)): + for b in range(len(types)): + print + print "CREATE TABLE t (a %s);" % (types[a]) + for x in values[a]: + print "INSERT INTO t VALUES (", x, ");" + if a > b: + print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/" + print "--error ER_UNSUPPORTED_EXTENSION" + print "ALTER TABLE t CHANGE COLUMN a a %s;" % (types[b]) + print "SELECT * FROM t;" + print "DROP TABLE t;" +def main(): + gen_matrix( + [ "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT" ], + [ [ -128, -1, 0, 1, 127 ], [ -32768, -1, 0, 1, 32767], [-8388608, -1, 0, 1, 8388607], [-2147483648, 0, 1, 2147483647], [-9223372036854775808, 0, 1, 9223372036854775807] ] + ) + gen_matrix( + [ "TINYINT UNSIGNED", "SMALLINT UNSIGNED", "MEDIUMINT UNSIGNED", "INT UNSIGNED", "BIGINT UNSIGNED" ], + [ [ 0, 1, 255 ], [ 0, 1, 65535], [0, 1, 16777215], [0, 1, 4294967295], [0, 1, 18446744073709551615] ] + ) + return 0 +sys.exit(main()) diff --git a/mysql-test/suite/tokudb.change_column/t/change_int.test b/mysql-test/suite/tokudb.change_column/t/change_int.test new file mode 100644 index 00000000000..bd5e746b026 --- /dev/null +++ b/mysql-test/suite/tokudb.change_column/t/change_int.test @@ -0,0 +1,266 @@ +# this test is generated by change_int.py +--disable_warnings +DROP TABLE IF EXISTS t; +--enable_warnings +SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB"; +SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1; + +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT); +INSERT INTO t VALUES ( -128 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 127 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT); +INSERT INTO t VALUES ( -32768 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 32767 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT); +INSERT INTO t VALUES ( -8388608 ); +INSERT INTO t VALUES ( -1 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 8388607 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT); +INSERT INTO t VALUES ( -2147483648 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 2147483647 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a SMALLINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a INT; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT); +INSERT INTO t VALUES ( -9223372036854775808 ); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 9223372036854775807 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT; +SELECT * FROM t; +DROP TABLE t; diff --git a/mysql-test/suite/tokudb.change_column/t/change_uint.test b/mysql-test/suite/tokudb.change_column/t/change_uint.test new file mode 100644 index 00000000000..e2b830e974c --- /dev/null +++ b/mysql-test/suite/tokudb.change_column/t/change_uint.test @@ -0,0 +1,226 @@ +# this test is generated by change_int.py +--disable_warnings +DROP TABLE IF EXISTS t; +--enable_warnings +SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB"; +SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1; + +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a TINYINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 255 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a SMALLINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 65535 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a MEDIUMINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 16777215 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a INT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 4294967295 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a TINYINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a SMALLINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a MEDIUMINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/ +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t CHANGE COLUMN a a INT UNSIGNED; +SELECT * FROM t; +DROP TABLE t; + +CREATE TABLE t (a BIGINT UNSIGNED); +INSERT INTO t VALUES ( 0 ); +INSERT INTO t VALUES ( 1 ); +INSERT INTO t VALUES ( 18446744073709551615 ); +ALTER TABLE t CHANGE COLUMN a a BIGINT UNSIGNED; +SELECT * FROM t; +DROP TABLE t;