mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-30048 Prefix keys for CHAR work differently for MyISAM vs InnoDB
Also fixes: MDEV-30050 Inconsistent results of DISTINCT with NOPAD Problem: Key segments for CHAR columns where compared using strnncollsp() for engines MyISAM and Aria. This did not work correct in case if the engine applyied trailing space compression. Fix: Replacing ha_compare_text() calls to new functions: - ha_compare_char_varying() - ha_compare_char_fixed() - ha_compare_word() - ha_compare_word_prefix() - ha_compare_word_or_prefix() The code branch corresponding to comparison of CHAR column keys (HA_KEYTYPE_TEXT segment type) now uses ha_compare_char_fixed() which calls strnncollsp_nchars(). This patch does not change the behavior for the rest of the code: - comparison of VARCHAR/TEXT column keys (HA_KEYTYPE_VARTEXT1, HA_KEYTYPE_VARTEXT2 segments types) - comparison in the fulltext code
This commit is contained in:
@ -58,11 +58,6 @@ DROP TABLE t1;
|
||||
|
||||
# CHAR
|
||||
|
||||
# MyISAM is buggy on CHAR+BTREE+UNIQUE+PREFIX (see MDEV-30048), disable for now
|
||||
# Other engines work fine
|
||||
|
||||
if (`SELECT UPPER(@@storage_engine) != 'MYISAM'`)
|
||||
{
|
||||
EXECUTE IMMEDIATE REPLACE(
|
||||
'CREATE TABLE t1 ( '
|
||||
' a CHAR(20) COLLATE <COLLATION>,'
|
||||
@ -72,7 +67,6 @@ SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ss ');
|
||||
INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
EXECUTE IMMEDIATE REPLACE(
|
||||
'CREATE TABLE t1 ( '
|
||||
|
54
mysql-test/include/ctype_utf8mb3_uca_char.inc
Normal file
54
mysql-test/include/ctype_utf8mb3_uca_char.inc
Normal file
@ -0,0 +1,54 @@
|
||||
--echo #
|
||||
--echo # MDEV-30048 Prefix keys for CHAR work differently for MyISAM vs InnoDB
|
||||
--echo #
|
||||
|
||||
SET NAMES utf8mb3;
|
||||
|
||||
#
|
||||
# Engines have different conditions based on the column size
|
||||
# determining when to use trailing space compressions in key values,
|
||||
# so let's test different column sizes for better coverage.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# CHAR(10)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ss'),('ß');
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a CHAR(10) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(2)));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ss'),('ß');
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# CHAR(120)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ss'),('ß');
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a CHAR(120) COLLATE utf8mb3_unicode_nopad_ci, UNIQUE KEY(a(100)));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ss'),('ß');
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30050 Inconsistent results of DISTINCT with NOPAD
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c CHAR(100) COLLATE utf8mb3_unicode_nopad_ci);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ss'),('ß');
|
||||
SET big_tables=0;
|
||||
SELECT DISTINCT c FROM t1;
|
||||
SET big_tables=1;
|
||||
SELECT DISTINCT c FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET big_tables=DEFAULT;
|
Reference in New Issue
Block a user