diff options
author | Magne Mahre <magne.mahre@sun.com> | 2010-02-11 18:02:41 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@sun.com> | 2010-02-11 18:02:41 +0100 |
commit | 93cd02bc82bfe48bad5c3d4daf3331207f3445a3 (patch) | |
tree | 4efcfe47732b7e2e03dfde221cc5b5dfb6e72399 /mysql-test/t/alter_table.test | |
parent | 5df69267c25d093fb1a87b3e9952812a66f0f687 (diff) | |
download | mariadb-git-93cd02bc82bfe48bad5c3d4daf3331207f3445a3.tar.gz |
Bug#50542 5.5.x doesn't check length of key prefixes:
corruption and crash results
An index creation statement where the index key
is larger/wider than the column it references
should throw an error.
A statement like:
CREATE TABLE t1 (a CHAR(1), PRIMARY KEY (A(255)))
did not error, but a segmentation fault followed when
an insertion was attempted on the table
The partial key validiation clause has been
restructured to (hopefully) better document which
uses of partial keys are valid.
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r-- | mysql-test/t/alter_table.test | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 2bfe6dbaa62..54c662bccf2 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1089,3 +1089,31 @@ ALTER TABLE t1 ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT = 1; DROP TABLE t1; + + +# +# Bug#50542 5.5.x doesn't check length of key prefixes: +# corruption and crash results +# +# This case is related to Bug#31031 (above) +# A statement where the index key is larger/wider than +# the column type, should cause an error +# +--error ER_WRONG_SUB_KEY +CREATE TABLE t1 (a CHAR(1), PRIMARY KEY (a(255))); + +# Test other variants of creating indices +CREATE TABLE t1 (a CHAR(1)); +# ALTER TABLE +--error ER_WRONG_SUB_KEY +ALTER TABLE t1 ADD PRIMARY KEY (a(20)); +--error ER_WRONG_SUB_KEY +ALTER TABLE t1 ADD KEY (a(20)); +# CREATE INDEX +--error ER_WRONG_SUB_KEY +CREATE UNIQUE INDEX i1 ON t1 (a(20)); +--error ER_WRONG_SUB_KEY +CREATE INDEX i2 ON t1 (a(20)); +# cleanup +DROP TABLE t1; + |