MDEV-20855 Crash with PARTITION BY LIST and extended characters

The code in convert_charset_partition_constant() did not
take into account that the call for item->safe_charset_converter()
can return NULL when conversion is not safe.

Note, 10.2 was not affected. The test for NULL presents in 10.2,
but it disappeared in 10.3 in a mistake. Restoring the test.
This commit is contained in:
Alexander Barkov 2019-10-18 10:24:53 +04:00
commit e0b6294338
5 changed files with 71 additions and 1 deletions

View file

@ -40,3 +40,25 @@ show create table t1;
insert into t1 values ('');
insert into t1 values (_ucs2 0x2020);
drop table t1;
--echo #
--echo # Start of 10.3 tests
--echo #
--echo #
--echo # MDEV-20855 Crash with PARTITION BY LIST and extended characters
--echo #
SET NAMES utf8;
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE OR REPLACE TABLE t1 (a CHAR(10)) CHARACTER SET latin1
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
CREATE OR REPLACE TABLE t1 (a TIME)
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
--echo #
--echo # End of 10.3 tests
--echo #