mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
refs #5333 add more column expansion tests
git-svn-id: file:///svn/mysql/tests/mysql-test@47670 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
e28b03f787
commit
70feab0941
8 changed files with 4763 additions and 1 deletions
|
@ -0,0 +1,23 @@
|
||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
|
||||||
|
SET SESSION DEFAULT_STORAGE_ENGINE='TokuDB';
|
||||||
|
CREATE TABLE t (a BINARY(100), b BINARY(200), KEY(a), KEY(b));
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(100);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(1);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(255);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(200);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(1);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(255);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
DROP TABLE t;
|
||||||
|
CREATE TABLE t (a BINARY(1), b BINARY(2), KEY(a,b));
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(3);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(3);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
DROP TABLE t;
|
|
@ -0,0 +1,21 @@
|
||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
|
||||||
|
SET SESSION DEFAULT_STORAGE_ENGINE='TokuDB';
|
||||||
|
CREATE TABLE t (a CHAR(100), b CHAR(200), KEY(a), KEY(b));
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(100);
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(1);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(255);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(200);
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(1);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(255);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
DROP TABLE t;
|
||||||
|
CREATE TABLE t (a CHAR(1), b CHAR(2), KEY(a,b));
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(3);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(3);
|
||||||
|
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
|
||||||
|
DROP TABLE t;
|
File diff suppressed because it is too large
Load diff
52
mysql-test/suite/tokudb.change_column/t/change_bin_key.test
Normal file
52
mysql-test/suite/tokudb.change_column/t/change_bin_key.test
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
# test that expansion of a binary field in a key is not supported
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
|
||||||
|
SET SESSION DEFAULT_STORAGE_ENGINE='TokuDB';
|
||||||
|
|
||||||
|
CREATE TABLE t (a BINARY(100), b BINARY(200), KEY(a), KEY(b));
|
||||||
|
|
||||||
|
# fill_alter_inplace_info bug, handler_flags == ALTER_COLUMN_TYPE + ALTER_COLUMN_DEFAULT, so we fail it
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(100);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(1);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(255);
|
||||||
|
|
||||||
|
# fill_alter_inplace_info bug, handler_flags == ALTER_COLUMN_TYPE + ALTER_COLUMN_DEFAULT, so we fail it
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(200);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(1);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(255);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
CREATE TABLE t (a BINARY(1), b BINARY(2), KEY(a,b));
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a BINARY(3);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b BINARY(3);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
|
46
mysql-test/suite/tokudb.change_column/t/change_char_key.test
Normal file
46
mysql-test/suite/tokudb.change_column/t/change_char_key.test
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# test that expansion of a char field in a key is not supported
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
|
||||||
|
SET SESSION DEFAULT_STORAGE_ENGINE='TokuDB';
|
||||||
|
|
||||||
|
CREATE TABLE t (a CHAR(100), b CHAR(200), KEY(a), KEY(b));
|
||||||
|
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(100);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(1);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(255);
|
||||||
|
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(200);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(1);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(255);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
CREATE TABLE t (a CHAR(1), b CHAR(2), KEY(a,b));
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN a a CHAR(3);
|
||||||
|
|
||||||
|
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
|
||||||
|
--error ER_UNSUPPORTED_EXTENSION
|
||||||
|
ALTER TABLE t CHANGE COLUMN b b CHAR(3);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,9 @@ def gen_test(n):
|
||||||
print "ALTER TABLE ti ENGINE=myisam;"
|
print "ALTER TABLE ti ENGINE=myisam;"
|
||||||
print "INSERT INTO ti SELECT * FROM t;"
|
print "INSERT INTO ti SELECT * FROM t;"
|
||||||
print "ALTER TABLE t CHANGE COLUMN a b CHAR(%d);" % (i)
|
print "ALTER TABLE t CHANGE COLUMN a b CHAR(%d);" % (i)
|
||||||
if i >= n:
|
if i < n:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
print "ALTER TABLE t CHANGE COLUMN b a CHAR(%d);" % (i)
|
print "ALTER TABLE t CHANGE COLUMN b a CHAR(%d);" % (i)
|
||||||
print "let $diff_tables=test.t, test.ti;"
|
print "let $diff_tables=test.t, test.ti;"
|
||||||
print "source include/diff_tables.inc;"
|
print "source include/diff_tables.inc;"
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# generate alter table test cases for integer types
|
||||||
|
|
||||||
|
import sys
|
||||||
|
def gen_test(types, values):
|
||||||
|
assert len(types) == 5;
|
||||||
|
print "CREATE TABLE tt (id BIGINT AUTO_INCREMENT PRIMARY KEY, a %s, b %s, c %s, d %s, e %s);" % (types[0], types[1], types[2], types[3], types[4])
|
||||||
|
# generate the cross product of all of the values
|
||||||
|
for a in values[0]:
|
||||||
|
for b in values[1]:
|
||||||
|
for c in values[2]:
|
||||||
|
for d in values[3]:
|
||||||
|
for e in values[4]:
|
||||||
|
print "INSERT INTO tt (a,b,c,d,e) VALUES (%d,%d,%d,%d,%d);" % (a, b, c, d, e)
|
||||||
|
print "CREATE TABLE ti like tt;"
|
||||||
|
print "ALTER TABLE ti ENGINE=myisam;"
|
||||||
|
print "INSERT INTO ti SELECT * from tt;"
|
||||||
|
print "ALTER TABLE tt CHANGE COLUMN a a %s, CHANGE COLUMN b b %s, CHANGE COLUMN c c %s, CHANGE COLUMN d d %s;" % (types[1], types[2], types[3], types[4])
|
||||||
|
print "SHOW CREATE TABLE tt;"
|
||||||
|
# leave the isam table with the original types. values should be the same.
|
||||||
|
print "#ALTER TABLE ti CHANGE COLUMN a a %s, CHANGE COLUMN b b %s, CHANGE COLUMN c c %s, CHANGE COLUMN d d %s;" % (types[1], types[2], types[3], types[4])
|
||||||
|
print "SHOW CREATE TABLE ti;"
|
||||||
|
print "let $diff_tables = test.tt, test.ti;"
|
||||||
|
print "source include/diff_tables.inc;"
|
||||||
|
print "DROP TABLE tt, ti;"
|
||||||
|
def main():
|
||||||
|
print "# this test is generated by change_int_data.py"
|
||||||
|
print "--disable_warnings"
|
||||||
|
print "DROP TABLE IF EXISTS tt, ti;"
|
||||||
|
print "--enable_warnings"
|
||||||
|
print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";"
|
||||||
|
print "SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;"
|
||||||
|
gen_test(
|
||||||
|
[ "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_test(
|
||||||
|
[ "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())
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue