Commit 4d4a171c authored by Rich Prohaska's avatar Rich Prohaska

refs #5333 char and bin expansion test cases

git-svn-id: file:///svn/mysql/tests/mysql-test@47579 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2a18b548
DROP TABLE IF EXISTS s,t;
SET DEFAULT_STORAGE_ENGINE='TokuDB';
CREATE TABLE s (a BINARY(1));
INSERT INTO s VALUES (1),(2),(3);
CREATE TABLE t LIKE s;
INSERT INTO t SELECT * FROM s;
SET TOKUDB_DISABLE_HOT_ALTER=0;
ALTER TABLE s CHANGE COLUMN a a BINARY(2);
SELECT HEX(a) FROM s;
HEX(a)
3100
3200
3300
SET TOKUDB_DISABLE_HOT_ALTER=1;
ALTER TABLE t CHANGE COLUMN a a BINARY(2);
SELECT HEX(a) FROM t;
HEX(a)
3100
3200
3300
DROP TABLE s,t;
This source diff could not be displayed because it is too large. You can view the blob instead.
# test that binary pad is zero
--disable_warnings
DROP TABLE IF EXISTS s,t;
--enable_warnings
SET DEFAULT_STORAGE_ENGINE='TokuDB';
CREATE TABLE s (a BINARY(1));
INSERT INTO s VALUES (1),(2),(3);
CREATE TABLE t LIKE s;
INSERT INTO t SELECT * FROM s;
SET TOKUDB_DISABLE_HOT_ALTER=0;
ALTER TABLE s CHANGE COLUMN a a BINARY(2);
SELECT HEX(a) FROM s;
SET TOKUDB_DISABLE_HOT_ALTER=1;
ALTER TABLE t CHANGE COLUMN a a BINARY(2);
SELECT HEX(a) FROM t;
DROP TABLE s,t;
\ No newline at end of file
#!/usr/bin/env python
# generate alter table test cases for integer types
import sys
def gen_test(n):
print "CREATE TABLE t (a CHAR(%d));" % (n)
for v in [ 'hi', 'there', 'people' ]:
print "INSERT INTO t VALUES ('%s');" % (v)
for i in range(2,256):
if i < n:
print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/"
print "--error ER_UNSUPPORTED_EXTENSION"
else:
print "CREATE TABLE tt LIKE t;"
print "INSERT INTO tt SELECT * FROM t;"
print "ALTER TABLE t CHANGE COLUMN a a CHAR(%d);" % (i)
if i >= n:
print "SELECT * FROM t,tt where t.a = tt.a;"
print "DROP TABLE tt;"
print "DROP TABLE t;"
def main():
print "# this test is generated by change_int.py"
print "--disable_warnings"
print "DROP TABLE IF EXISTS t,tt;"
print "--enable_warnings"
print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";"
print "SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;"
# all n takes too long to run, so here is a subset of tests
for n in [ 1, 2, 3, 4, 5, 6, 7, 8, 16, 31, 32, 63, 64, 127, 128, 254, 255 ]:
gen_test(n)
return 0
sys.exit(main())
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# generate alter table test cases for integer types # generate alter table test cases for integer types
import sys import sys
def gen_matrix(types, values): def gen_test(types, values):
print "# this test is generated by change_int.py" print "# this test is generated by change_int.py"
print "--disable_warnings" print "--disable_warnings"
print "DROP TABLE IF EXISTS t;" print "DROP TABLE IF EXISTS t;"
...@@ -23,11 +23,11 @@ def gen_matrix(types, values): ...@@ -23,11 +23,11 @@ def gen_matrix(types, values):
print "SELECT * FROM t;" print "SELECT * FROM t;"
print "DROP TABLE t;" print "DROP TABLE t;"
def main(): def main():
gen_matrix( gen_test(
[ "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT" ], [ "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] ] [ [ -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( gen_test(
[ "TINYINT UNSIGNED", "SMALLINT UNSIGNED", "MEDIUMINT UNSIGNED", "INT UNSIGNED", "BIGINT UNSIGNED" ], [ "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] ] [ [ 0, 1, 255 ], [ 0, 1, 65535], [0, 1, 16777215], [0, 1, 4294967295], [0, 1, 18446744073709551615] ]
) )
......
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