mirror of
https://github.com/MariaDB/server.git
synced 2025-03-26 08:58:40 +01:00
MDEV-21245 InnoDB: Using a partial-field key prefix in search
ha_innobase::compare_key_parts(): If a full column index is being replaced with a column prefix index, return Compare_keys::NotEqual.
This commit is contained in:
parent
b4712242dd
commit
852e1383e3
3 changed files with 34 additions and 0 deletions
mysql-test/suite/innodb
storage/innobase/handler
|
@ -90,3 +90,19 @@ worklog5743;
|
|||
col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
|
||||
1 1
|
||||
DROP TABLE worklog5743;
|
||||
#
|
||||
# MDEV-21245 InnoDB: Using a partial-field key prefix in search
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(255), KEY k(a)) DEFAULT CHARSET=utf8mb3
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 set a='';
|
||||
alter table t1 change a a varchar(3000);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 1
|
||||
Warnings:
|
||||
Note 1071 Specified key was too long; max key length is 3072 bytes
|
||||
SELECT * FROM t1 WHERE a IN ('');
|
||||
a
|
||||
|
||||
DROP TABLE t1;
|
||||
# End of 10.4 tests
|
||||
|
|
|
@ -93,3 +93,17 @@ SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
|
|||
worklog5743;
|
||||
|
||||
DROP TABLE worklog5743;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21245 InnoDB: Using a partial-field key prefix in search
|
||||
--echo #
|
||||
CREATE TABLE t1 (a VARCHAR(255), KEY k(a)) DEFAULT CHARSET=utf8mb3
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO t1 set a='';
|
||||
--enable_info
|
||||
alter table t1 change a a varchar(3000);
|
||||
--disable_info
|
||||
SELECT * FROM t1 WHERE a IN ('');
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
|
|
@ -21199,6 +21199,10 @@ Compare_keys ha_innobase::compare_key_parts(
|
|||
if (old_part.length >= new_part.length)
|
||||
return Compare_keys::NotEqual;
|
||||
|
||||
if (old_part.length == old_field.key_length() &&
|
||||
new_part.length != new_field.key_length)
|
||||
return Compare_keys::NotEqual;
|
||||
|
||||
return Compare_keys::EqualButKeyPartLength;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue