mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
refs #5333 char and bin expansion test cases
git-svn-id: file:///svn/mysql/tests/mysql-test@47579 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
2a18b548b6
commit
4d4a171cb0
6 changed files with 51968 additions and 3 deletions
|
@ -0,0 +1,21 @@
|
|||
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;
|
32159
mysql-test/suite/tokudb.change_column/r/change_char.result
Normal file
32159
mysql-test/suite/tokudb.change_column/r/change_char.result
Normal file
File diff suppressed because it is too large
Load diff
16
mysql-test/suite/tokudb.change_column/t/change_bin_pad.test
Normal file
16
mysql-test/suite/tokudb.change_column/t/change_bin_pad.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
# 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;
|
34
mysql-test/suite/tokudb.change_column/t/change_char.py
Normal file
34
mysql-test/suite/tokudb.change_column/t/change_char.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/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())
|
19735
mysql-test/suite/tokudb.change_column/t/change_char.test
Normal file
19735
mysql-test/suite/tokudb.change_column/t/change_char.test
Normal file
File diff suppressed because it is too large
Load diff
|
@ -3,7 +3,7 @@
|
|||
# generate alter table test cases for integer types
|
||||
|
||||
import sys
|
||||
def gen_matrix(types, values):
|
||||
def gen_test(types, values):
|
||||
print "# this test is generated by change_int.py"
|
||||
print "--disable_warnings"
|
||||
print "DROP TABLE IF EXISTS t;"
|
||||
|
@ -23,11 +23,11 @@ def gen_matrix(types, values):
|
|||
print "SELECT * FROM t;"
|
||||
print "DROP TABLE t;"
|
||||
def main():
|
||||
gen_matrix(
|
||||
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_matrix(
|
||||
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] ]
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue