Commit 064bfbaf authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23499 Assertion c.same_type(*o) failed

dict_col_t::same_encoding(), dict_col_t::same_format(): Allow
an instantaneous change of a column to a compatible encoding,
just like ha_innobase::can_convert_string() and similar functions do.
parent 5c8a1249
...@@ -407,4 +407,10 @@ CREATE TABLE t (i INT PRIMARY KEY) ENGINE=InnoDB; ...@@ -407,4 +407,10 @@ CREATE TABLE t (i INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t SET i=1; INSERT INTO t SET i=1;
ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT;
DROP TABLE t; DROP TABLE t;
#
# MDEV-23499 Assertion c.same_type(*o) failed
#
CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB;
ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST;
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
...@@ -429,4 +429,11 @@ INSERT INTO t SET i=1; ...@@ -429,4 +429,11 @@ INSERT INTO t SET i=1;
ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-23499 Assertion c.same_type(*o) failed
--echo #
CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB;
ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST;
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
...@@ -120,7 +120,7 @@ bool dict_col_t::same_encoding(uint16_t a, uint16_t b) ...@@ -120,7 +120,7 @@ bool dict_col_t::same_encoding(uint16_t a, uint16_t b)
{ {
if (const CHARSET_INFO *acs= get_charset(a, MYF(MY_WME))) if (const CHARSET_INFO *acs= get_charset(a, MYF(MY_WME)))
if (const CHARSET_INFO *bcs= get_charset(b, MYF(MY_WME))) if (const CHARSET_INFO *bcs= get_charset(b, MYF(MY_WME)))
return Charset(acs).same_encoding(bcs); return Charset(bcs).encoding_allows_reinterpret_as(acs);
return false; return false;
} }
......
...@@ -728,7 +728,7 @@ struct dict_col_t{ ...@@ -728,7 +728,7 @@ struct dict_col_t{
bool same_format(const dict_col_t &other) const bool same_format(const dict_col_t &other) const
{ {
return same_type(other) && len >= other.len && return same_type(other) && len >= other.len &&
mbminlen == other.mbminlen && mbmaxlen == other.mbmaxlen && mbminlen == other.mbminlen && mbmaxlen >= other.mbmaxlen &&
!((prtype ^ other.prtype) & ~(DATA_NOT_NULL | DATA_VERSIONED | !((prtype ^ other.prtype) & ~(DATA_NOT_NULL | DATA_VERSIONED |
CHAR_COLL_MASK << 16 | CHAR_COLL_MASK << 16 |
DATA_LONG_TRUE_VARCHAR)); DATA_LONG_TRUE_VARCHAR));
......
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