Commit faa6e598 authored by Rich Prohaska's avatar Rich Prohaska

refs #5333 #5334 more field expansion tests

git-svn-id: file:///svn/mysql/tests/mysql-test@47582 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4d4a171c
This source diff could not be displayed because it is too large. You can view the blob instead.
DROP TABLE IF EXISTS t;
SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB";
CREATE TABLE t (a INT PRIMARY KEY, b INT, c INT, d INT);
INSERT INTO t VALUES (1,2,3,4),(2,3,4,5);
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;
ALTER TABLE t CHANGE COLUMN b b BIGINT;
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
ALTER TABLE t CHANGE COLUMN c c BIGINT;
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
ALTER TABLE t CHANGE COLUMN d d BIGINT;
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
DROP TABLE t;
CREATE TABLE t (a INT PRIMARY KEY, b INT, c INT, d INT, CLUSTERING KEY(c));
INSERT INTO t VALUES (1,2,3,4),(2,3,4,5);
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;
ALTER TABLE t CHANGE COLUMN b b BIGINT;
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
ALTER TABLE t CHANGE COLUMN d d BIGINT;
SELECT * FROM t;
a b c d
1 2 3 4
2 3 4 5
DROP TABLE t;
#!/usr/bin/env python
# generate alter table test cases for integer types
import sys
def gen_test(n):
print "CREATE TABLE t (a BINARY(%d));" % (n)
for v in [ 1,2,3 ]:
print "INSERT INTO t VALUES (%d);" % (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 BINARY(%d);" % (i)
if i >= n:
print "SELECT HEX(t.a),HEX(tt.a) 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.
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB";
CREATE TABLE t (a CHAR(10), b CHAR(10));
INSERT INTO t VALUES ('hi', 'there');
INSERT INTO t VALUES ('you', 'people');
SELECT * FROM t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;
ALTER TABLE t CHANGE COLUMN a a CHAR(20), CHANGE COLUMN b b CHAR(30);
SELECT * FROM t;
DROP TABLE t;
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION DEFAULT_STORAGE_ENGINE="TokuDB";
CREATE TABLE t (a INT PRIMARY KEY, b INT, c INT, d INT);
INSERT INTO t VALUES (1,2,3,4),(2,3,4,5);
SELECT * FROM t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;
ALTER TABLE t CHANGE COLUMN b b BIGINT;
SELECT * FROM t;
ALTER TABLE t CHANGE COLUMN c c BIGINT;
SELECT * FROM t;
ALTER TABLE t CHANGE COLUMN d d BIGINT;
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (a INT PRIMARY KEY, b INT, c INT, d INT, CLUSTERING KEY(c));
INSERT INTO t VALUES (1,2,3,4),(2,3,4,5);
SELECT * FROM t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;
ALTER TABLE t CHANGE COLUMN b b BIGINT;
SELECT * FROM t;
ALTER TABLE t CHANGE COLUMN d d BIGINT;
SELECT * FROM t;
DROP TABLE t;
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