Commit 1c7ee6a7 authored by Rich Prohaska's avatar Rich Prohaska

refs #5333 add change column tests for varchar expansion

git-svn-id: file:///svn/mysql/tests/mysql-test@47481 c7de825b-a66e-492c-adef-691d508d4ae1
parent 19391606
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 TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
SELECT * FROM t;
a b
hi there
you people
DROP TABLE t;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
SELECT * FROM t;
a b
hi there
you people
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100) NOT NULL DEFAULT '', b VARBINARY(256) NOT NULL DEFAULT '') ENGINE=TokuDB;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varbinary(100) NOT NULL DEFAULT '',
`b` varbinary(256) NOT NULL DEFAULT ''
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255) NOT NULL DEFAULT 'a';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varbinary(255) NOT NULL DEFAULT 'a',
`b` varbinary(256) NOT NULL DEFAULT ''
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256) NOT NULL DEFAULT 'b';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varbinary(256) NOT NULL DEFAULT 'b',
`b` varbinary(256) NOT NULL DEFAULT ''
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255) NOT NULL DEFAULT 'c';
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024) NOT NULL DEFAULT 'd';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varbinary(256) NOT NULL DEFAULT 'b',
`b` varbinary(1024) NOT NULL DEFAULT 'd'
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256) NOT NULL DEFAULT 'e';
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256), KEY(a), KEY(b)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(100);
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256);
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
CREATE TABLE t (a VARBINARY(1), b VARBINARY(2), KEY(a,b)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(3);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(3);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(100)) ENGINE=Tokudb;
INSERT INTO t VALUES ('hi','there'),('you','people');
SELECT * FROM t;
a b
hi there
you people
ALTER TABLE t CHANGE COLUMN a a VARBINARY(101);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varbinary(101) DEFAULT NULL,
`b` varbinary(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARBINARY(200);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varbinary(200) DEFAULT NULL,
`b` varbinary(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
SELECT * FROM t;
a b
hi there
you people
DROP TABLE t;
CREATE TABLE t (i INT, a VARBINARY(100), b VARBINARY(100)) ENGINE=Tokudb;
INSERT INTO t VALUES (1, 'hi','there'),(2, 'you','people');
SELECT * FROM t;
i a b
1 hi there
2 you people
ALTER TABLE t CHANGE COLUMN a a VARBINARY(101);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`i` int(11) DEFAULT NULL,
`a` varbinary(101) DEFAULT NULL,
`b` varbinary(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARBINARY(200);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`i` int(11) DEFAULT NULL,
`a` varbinary(200) DEFAULT NULL,
`b` varbinary(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
SELECT * FROM t;
i a b
1 hi there
2 you people
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
CREATE TABLE t (a VARBINARY(100) NOT NULL, b VARBINARY(256) NOT NULL) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a aa VARBINARY(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a aa VARBINARY(255);
ALTER TABLE t CHANGE COLUMN aa a VARBINARY(255);
ALTER TABLE t CHANGE COLUMN b bb VARBINARY(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b bb VARBINARY(1024);
ALTER TABLE t CHANGE COLUMN bb b VARBINARY(1024);
ALTER TABLE t CHANGE COLUMN b bb VARBINARY(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(1)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(100);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1000);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
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 TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(255)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1) CHARACTER SET latin1 COLLATE latin1_general_cs;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_general_cs;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256) CHARACTER SET latin1 COLLATE latin1_general_cs;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
SELECT * FROM t;
a b
hi there
you people
DROP TABLE t;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
SELECT * FROM t;
a b
hi there
you people
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100) NOT NULL DEFAULT '', b VARCHAR(256) NOT NULL DEFAULT '') ENGINE=TokuDB;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varchar(100) NOT NULL DEFAULT '',
`b` varchar(256) NOT NULL DEFAULT ''
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255) NOT NULL DEFAULT 'a';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varchar(255) NOT NULL DEFAULT 'a',
`b` varchar(256) NOT NULL DEFAULT ''
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256) NOT NULL DEFAULT 'b';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varchar(256) NOT NULL DEFAULT 'b',
`b` varchar(256) NOT NULL DEFAULT ''
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255) NOT NULL DEFAULT 'c';
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024) NOT NULL DEFAULT 'd';
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varchar(256) NOT NULL DEFAULT 'b',
`b` varchar(1024) NOT NULL DEFAULT 'd'
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256) NOT NULL DEFAULT 'e';
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256), KEY(a), KEY(b)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(100);
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256);
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
CREATE TABLE t (a VARCHAR(1), b VARCHAR(2), KEY(a,b)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(3);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(3);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(100)) ENGINE=Tokudb;
INSERT INTO t VALUES ('hi','there'),('you','people');
SELECT * FROM t;
a b
hi there
you people
ALTER TABLE t CHANGE COLUMN a a VARCHAR(101);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varchar(101) DEFAULT NULL,
`b` varchar(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARCHAR(200);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` varchar(200) DEFAULT NULL,
`b` varchar(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
SELECT * FROM t;
a b
hi there
you people
DROP TABLE t;
CREATE TABLE t (i INT, a VARCHAR(100), b VARCHAR(100)) ENGINE=Tokudb;
INSERT INTO t VALUES (1, 'hi','there'),(2, 'you','people');
SELECT * FROM t;
i a b
1 hi there
2 you people
ALTER TABLE t CHANGE COLUMN a a VARCHAR(101);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`i` int(11) DEFAULT NULL,
`a` varchar(101) DEFAULT NULL,
`b` varchar(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
ALTER TABLE t CHANGE COLUMN a a VARCHAR(200);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`i` int(11) DEFAULT NULL,
`a` varchar(200) DEFAULT NULL,
`b` varchar(100) DEFAULT NULL
) ENGINE=TokuDB DEFAULT CHARSET=latin1
SELECT * FROM t;
i a b
1 hi there
2 you people
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256) NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
CREATE TABLE t (a VARCHAR(100) NOT NULL, b VARCHAR(256) NOT NULL) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a aa VARCHAR(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a aa VARCHAR(255);
ALTER TABLE t CHANGE COLUMN aa a VARCHAR(255);
ALTER TABLE t CHANGE COLUMN b bb VARCHAR(255);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN b bb VARCHAR(1024);
ALTER TABLE t CHANGE COLUMN bb b VARCHAR(1024);
ALTER TABLE t CHANGE COLUMN b bb VARCHAR(256);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
DROP TABLE IF EXISTS t;
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(1)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(100);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1000);
ERROR 42000: Table 't' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t;
# test that varbinary expansion is done inplace while varbinary shrinkage is not
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(1)) ENGINE=TokuDB;
SHOW CREATE TABLE t;
# 1->1
let $i=1
EVAL ALTER TABLE t CHANGE COLUMN a a VARBINARY($i);
# 1->2 ... 1023->1024 is supported
# 1024 is an arbitrary limit >= 256
let $i=2;
while ($i <= 1024)
{
# $i-1 -> $i
EVAL ALTER TABLE t CHANGE COLUMN a a VARBINARY($i);
# $i -> $i
EVAL ALTER TABLE t CHANGE COLUMN a a VARBINARY($i);
inc $i;
}
# shrink from 1024->$i where $i < 1024 is not supported
let $i=1023;
while ($i > 0)
{
--error ER_UNSUPPORTED_EXTENSION
EVAL ALTER TABLE t CHANGE COLUMN a a VARBINARY($i);
dec $i;
}
DROP TABLE t;
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
# expand varbinary
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
# expand varbinary and rename column
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
SELECT * FROM t;
DROP TABLE t;
\ No newline at end of file
# test that varbinary expansion + default change works
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100) NOT NULL DEFAULT '', b VARBINARY(256) NOT NULL DEFAULT '') ENGINE=TokuDB;
SHOW CREATE TABLE t;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255) NOT NULL DEFAULT 'a';
SHOW CREATE TABLE t;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256) NOT NULL DEFAULT 'b';
SHOW CREATE TABLE t;
# no shrinkage
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255) NOT NULL DEFAULT 'c';
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024) NOT NULL DEFAULT 'd';
SHOW CREATE TABLE t;
# no shrinkage
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256) NOT NULL DEFAULT 'e';
DROP TABLE t;
\ No newline at end of file
# test that varbinary expansion of a field in a key is not supported
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256), KEY(a), KEY(b)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARBINARY(100);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024);
DROP TABLE t;
CREATE TABLE t (a VARBINARY(1), b VARBINARY(2), KEY(a,b)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(3);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(3);
DROP TABLE t;
# test that varbinary expansion changes the length sum works
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
# multiple fields all < 256
CREATE TABLE t (a VARBINARY(100), b VARBINARY(100)) ENGINE=Tokudb;
INSERT INTO t VALUES ('hi','there'),('you','people');
SELECT * FROM t;
# schema only
ALTER TABLE t CHANGE COLUMN a a VARBINARY(101);
SHOW CREATE TABLE t;
# update offsets
ALTER TABLE t CHANGE COLUMN a a VARBINARY(200);
SHOW CREATE TABLE t;
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (i INT, a VARBINARY(100), b VARBINARY(100)) ENGINE=Tokudb;
INSERT INTO t VALUES (1, 'hi','there'),(2, 'you','people');
SELECT * FROM t;
# schema only
ALTER TABLE t CHANGE COLUMN a a VARBINARY(101);
SHOW CREATE TABLE t;
# update offsets
ALTER TABLE t CHANGE COLUMN a a VARBINARY(200);
SHOW CREATE TABLE t;
SELECT * FROM t;
DROP TABLE t;
# test that varbinary(X) to varbinary(X) not null is not supported (different type)
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
# nullable -> not null not supporte
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256) NOT NULL;
DROP TABLE t;
# not null -> nullable not supported
CREATE TABLE t (a VARBINARY(100) NOT NULL, b VARBINARY(256) NOT NULL) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(256);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(1024);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARBINARY(256);
DROP TABLE t;
# test that varbinary changed with column rename work
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(100), b VARBINARY(256)) ENGINE=TokuDB;
# varbinary shrink with column rename is not supported
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a aa VARBINARY(1);
# varbinary expand with column rename is supported
ALTER TABLE t CHANGE COLUMN a aa VARBINARY(255);
# varbinary column rename is supported
ALTER TABLE t CHANGE COLUMN aa a VARBINARY(255);
# varbinary shrink woth column rename is not supported
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b bb VARBINARY(255);
# varbinary expand with column rename is supported
ALTER TABLE t CHANGE COLUMN b bb VARBINARY(1024);
# varbinary column rename is supported
ALTER TABLE t CHANGE COLUMN bb b VARBINARY(1024);
# varbinary shrink with column rename is not supported
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b bb VARBINARY(256);
DROP TABLE t;
\ No newline at end of file
# test that varbin to varchar change is not inplace
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARBINARY(1)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(100);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1000);
DROP TABLE t;
# test that varchar expansion is done inplace while varchar shrinkage is not
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(1)) ENGINE=TokuDB;
SHOW CREATE TABLE t;
# 1->1
let $i=1
EVAL ALTER TABLE t CHANGE COLUMN a a VARCHAR($i);
# 1->2 ... 1023->1024 is supported
# 1024 is an arbitrary limit >= 256
let $i=2;
while ($i <= 1024)
{
# $i-1 -> $i
EVAL ALTER TABLE t CHANGE COLUMN a a VARCHAR($i);
# $i -> $i
EVAL ALTER TABLE t CHANGE COLUMN a a VARCHAR($i);
inc $i;
}
# shrink from 1024->$i where $i < 1024 is not supported
let $i=1023;
while ($i > 0)
{
--error ER_UNSUPPORTED_EXTENSION
EVAL ALTER TABLE t CHANGE COLUMN a a VARCHAR($i);
dec $i;
}
DROP TABLE t;
# test that varchar change with different charset is not supported inplace
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(255)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1) CHARACTER SET latin1 COLLATE latin1_general_cs;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_general_cs;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256) CHARACTER SET latin1 COLLATE latin1_general_cs;
DROP TABLE t;
\ No newline at end of file
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
# expand varchar
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
INSERT INTO t VALUES ('hi','there'),('you','people');
# expand varchar and rename column
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
SELECT * FROM t;
DROP TABLE t;
\ No newline at end of file
# test that varchar expansion + default change works
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100) NOT NULL DEFAULT '', b VARCHAR(256) NOT NULL DEFAULT '') ENGINE=TokuDB;
SHOW CREATE TABLE t;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255) NOT NULL DEFAULT 'a';
SHOW CREATE TABLE t;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256) NOT NULL DEFAULT 'b';
SHOW CREATE TABLE t;
# no shrinkage
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255) NOT NULL DEFAULT 'c';
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024) NOT NULL DEFAULT 'd';
SHOW CREATE TABLE t;
# no shrinkage
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256) NOT NULL DEFAULT 'e';
DROP TABLE t;
\ No newline at end of file
# test that varchar expansion of a field in a key is not supported
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256), KEY(a), KEY(b)) ENGINE=TokuDB;
ALTER TABLE t CHANGE COLUMN a a VARCHAR(100);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024);
DROP TABLE t;
CREATE TABLE t (a VARCHAR(1), b VARCHAR(2), KEY(a,b)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(3);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(3);
DROP TABLE t;
# test that varchar expansion changes the length sum works
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
# multiple fields all < 256
CREATE TABLE t (a VARCHAR(100), b VARCHAR(100)) ENGINE=Tokudb;
INSERT INTO t VALUES ('hi','there'),('you','people');
SELECT * FROM t;
# schema only
ALTER TABLE t CHANGE COLUMN a a VARCHAR(101);
SHOW CREATE TABLE t;
# update offsets
ALTER TABLE t CHANGE COLUMN a a VARCHAR(200);
SHOW CREATE TABLE t;
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (i INT, a VARCHAR(100), b VARCHAR(100)) ENGINE=Tokudb;
INSERT INTO t VALUES (1, 'hi','there'),(2, 'you','people');
SELECT * FROM t;
# schema only
ALTER TABLE t CHANGE COLUMN a a VARCHAR(101);
SHOW CREATE TABLE t;
# update offsets
ALTER TABLE t CHANGE COLUMN a a VARCHAR(200);
SHOW CREATE TABLE t;
SELECT * FROM t;
DROP TABLE t;
# test that varchar(X) to varchar(X) not null is not supported (different type)
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
# nullable -> not null not supporte
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024) NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256) NOT NULL;
DROP TABLE t;
# not null -> nullable not supported
CREATE TABLE t (a VARCHAR(100) NOT NULL, b VARCHAR(256) NOT NULL) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(1);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARCHAR(256);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(255);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(1024);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b b VARCHAR(256);
DROP TABLE t;
# test that varchar changed with column rename work
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(100), b VARCHAR(256)) ENGINE=TokuDB;
# varchar shrink with column rename is not supported
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a aa VARCHAR(1);
# varchar expand with column rename is supported
ALTER TABLE t CHANGE COLUMN a aa VARCHAR(255);
# varchar column rename is supported
ALTER TABLE t CHANGE COLUMN aa a VARCHAR(255);
# varchar shrink woth column rename is not supported
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b bb VARCHAR(255);
# varchar expand with column rename is supported
ALTER TABLE t CHANGE COLUMN b bb VARCHAR(1024);
# varchar column rename is supported
ALTER TABLE t CHANGE COLUMN bb b VARCHAR(1024);
# varchar shrink with column rename is not supported
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN b bb VARCHAR(256);
DROP TABLE t;
\ No newline at end of file
# test that varchar to varbin change is not supported inplace
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
SET SESSION TOKUDB_DISABLE_SLOW_ALTER=ON;
CREATE TABLE t (a VARCHAR(1)) ENGINE=TokuDB;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(100);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a VARBINARY(1000);
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