Commit 931549ff authored by Alexander Barkov's avatar Alexander Barkov

MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit

Also fixes:

MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit

The "strnncollsp_nchars" virtual function pointer for tis620_thai_nopad_ci
was incorrectly initialized to a generic function
my_strnncollsp_nchars_generic_8bit(), which crashed on assert.

Implementing a tis620 specific function version.
parent 3e0fd5e8
...@@ -4432,3 +4432,28 @@ HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci)) ...@@ -4432,3 +4432,28 @@ HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci))
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# Start of 10.4 tests
#
#
# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE OR REPLACE TABLE t1
(
a VARCHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a'),('A');
ERROR 23000: Duplicate entry 'A' for key 'a'
DROP TABLE t1;
CREATE OR REPLACE TABLE t1
(
a CHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a'),('A');
ERROR 23000: Duplicate entry 'A' for key 'a'
DROP TABLE t1;
#
# End of 10.4 tests
#
...@@ -223,3 +223,34 @@ SELECT HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci)); ...@@ -223,3 +223,34 @@ SELECT HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci));
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
CREATE OR REPLACE TABLE t1
(
a VARCHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES ('a'),('A');
DROP TABLE t1;
CREATE OR REPLACE TABLE t1
(
a CHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES ('a'),('A');
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
...@@ -26,3 +26,69 @@ DROP TABLE t1; ...@@ -26,3 +26,69 @@ DROP TABLE t1;
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# Start of 10.4 tests
#
#
# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
DROP TABLE t1;
#
# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,4,4);
DROP TABLE t1;
CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2;
HEX(c1) HEX (c2)
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13);
Warnings:
Warning 1264 Out of range value for column 'b' at row 1
SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1;
GROUP_CONCAT(DISTINCT a,b ORDER BY c,b)
4294967295157,1042147483647
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0);
ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1;
GROUP_CONCAT(DISTINCT a,c ORDER BY a)
42949672950
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0);
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0);
SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a;
a SUM(DISTINCT a) MIN(b)
0 0 0
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
#
# End of 10.4 tests
#
...@@ -27,3 +27,65 @@ DROP TABLE t1; ...@@ -27,3 +27,65 @@ DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
DROP TABLE t1;
--echo #
--echo # MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,4,4);
DROP TABLE t1;
CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12);
INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13);
SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0);
ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4);
INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1);
SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0);
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0);
SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
#
# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN ('')
);
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN (' ')
);
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (' '),
PARTITION p VALUES LESS THAN ('')
);
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
CREATE TABLE t1
(
id INT NOT NULL,
data VARCHAR(2),
KEY data_id (data(1),id)
) COLLATE tis620_thai_nopad_ci ENGINE=MyISAM
PARTITION BY RANGE (id)
(
PARTITION p10 VALUES LESS THAN (10),
PARTITION p20 VALUES LESS THAN (20)
);
INSERT INTO t1 VALUES (4, 'ab'), (14, 'ab'), (19,''),(9,'') ;
SELECT id FROM t1 WHERE data='' ORDER BY id;
id
9
19
DROP TABLE t1;
--source include/have_partition.inc
--source include/have_tis620.inc
--echo #
--echo # MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
--error ER_RANGE_NOT_INCREASING_ERROR
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN ('')
);
--error ER_RANGE_NOT_INCREASING_ERROR
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN (' ')
);
--error ER_RANGE_NOT_INCREASING_ERROR
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (' '),
PARTITION p VALUES LESS THAN ('')
);
CREATE TABLE t1
(
id INT NOT NULL,
data VARCHAR(2),
KEY data_id (data(1),id)
) COLLATE tis620_thai_nopad_ci ENGINE=MyISAM
PARTITION BY RANGE (id)
(
PARTITION p10 VALUES LESS THAN (10),
PARTITION p20 VALUES LESS THAN (20)
);
INSERT INTO t1 VALUES (4, 'ab'), (14, 'ab'), (19,''),(9,'') ;
SELECT id FROM t1 WHERE data='' ORDER BY id;
DROP TABLE t1;
...@@ -585,6 +585,18 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), ...@@ -585,6 +585,18 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
} }
static int
my_strnncollsp_nchars_tis620(CHARSET_INFO * cs,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
size_t nchars)
{
set_if_smaller(a_length, nchars);
set_if_smaller(b_length, nchars);
return my_strnncollsp_tis620(cs, a, a_length, b, b_length);
}
static static
int my_strnncollsp_tis620_nopad(CHARSET_INFO * cs __attribute__((unused)), int my_strnncollsp_tis620_nopad(CHARSET_INFO * cs __attribute__((unused)),
const uchar *a0, size_t a_length, const uchar *a0, size_t a_length,
...@@ -852,7 +864,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = ...@@ -852,7 +864,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
NULL, /* init */ NULL, /* init */
my_strnncoll_tis620, my_strnncoll_tis620,
my_strnncollsp_tis620, my_strnncollsp_tis620,
my_strnncollsp_nchars_generic_8bit, my_strnncollsp_nchars_tis620,
my_strnxfrm_tis620, my_strnxfrm_tis620,
my_strnxfrmlen_simple, my_strnxfrmlen_simple,
my_like_range_simple, my_like_range_simple,
...@@ -868,7 +880,7 @@ static MY_COLLATION_HANDLER my_collation_nopad_ci_handler = ...@@ -868,7 +880,7 @@ static MY_COLLATION_HANDLER my_collation_nopad_ci_handler =
NULL, /* init */ NULL, /* init */
my_strnncoll_tis620, my_strnncoll_tis620,
my_strnncollsp_tis620_nopad, my_strnncollsp_tis620_nopad,
my_strnncollsp_nchars_generic_8bit, my_strnncollsp_nchars_tis620,
my_strnxfrm_tis620_nopad, my_strnxfrm_tis620_nopad,
my_strnxfrmlen_simple, my_strnxfrmlen_simple,
my_like_range_simple, my_like_range_simple,
......
...@@ -1214,6 +1214,7 @@ test_strnncollsp_char() ...@@ -1214,6 +1214,7 @@ test_strnncollsp_char()
#ifdef HAVE_CHARSET_tis620 #ifdef HAVE_CHARSET_tis620
failed+= strnncollsp_char_mbminlen1("tis620_thai_ci", NULL); failed+= strnncollsp_char_mbminlen1("tis620_thai_ci", NULL);
failed+= strnncollsp_char_mbminlen1("tis620_thai_nopad_ci", NULL);
#endif #endif
#ifdef HAVE_CHARSET_big5 #ifdef HAVE_CHARSET_big5
......
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