1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #31031 ALTER TABLE regression in 5.0

An ALTER TABLE statement which added a column and added
a non-partial index on it failed with:
            
"ERROR 1089 (HY000): Incorrect sub part key; the used
key part isn't a string, the used length is longer than
the key part, or the storage engine doesn't support unique
sub keys"
            
In a check introduced to fix an earlier bug (no. 26794),
to allow for indices on spatial type columns, the
test expression was flawed (a logical OR was used instead
of a logical AND), which led to this regression.
            
The code in question does a sanity check on the key, and
the flawed code mistakenly classified any index created
in the way specified above as a partial index.  Since
many data types does not allow partial indices, the
statement would fail.
This commit is contained in:
Magne Mahre
2009-10-09 15:04:58 +02:00
parent c9248c6424
commit 5ca59914ce
3 changed files with 38 additions and 7 deletions

View File

@ -1001,3 +1001,18 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests
#
# Bug #31031 ALTER TABLE regression in 5.0
#
# The ALTER TABLE operation failed with
# ERROR 1089 (HY000): Incorrect sub part key; ...
#
CREATE TABLE t1(c CHAR(10),
i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES('a',2),('b',4),('c',6);
ALTER TABLE t1
DROP i,
ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT = 1;
DROP TABLE t1;