diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-25 15:22:21 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-25 15:26:22 +0200 |
commit | f9ceb0a67ffb20631c936a7e8e8776c000d677ac (patch) | |
tree | 9d7713434005ae307b8a7d200d5f28d6b18bf8eb /sql/sql_string.h | |
parent | a34c34d9a8d3159c5a0de281f4b0253a58ab2311 (diff) | |
download | mariadb-git-f9ceb0a67ffb20631c936a7e8e8776c000d677ac.tar.gz |
MDEV-20190 Instant operation fails when add column and collation change on non-indexed column
We must relax too strict debug assertions. For latin1_swedish_ci,
mtype=DATA_CHAR or mtype=DATA_VARCHAR will be used instead of
mtype=DATA_MYSQL or mtype=DATA_VARMYSQL. Likewise, some changes of
dtype_get_charset_coll() do not affect the data type encoding,
but only any indexes that are defined on the column.
Charset::same_encoding(): Check whether two charset-collations have
the same character set encoding.
dict_col_t::same_encoding(): Check whether two character columns
have the same character set encoding.
dict_col_t::same_type(): Check whether two columns have a compatible
data type encoding.
dict_col_t::same_format(), dict_table_t::instant_column(): Do not
compare mtype or the charset-collation of prtype directly.
Rely on dict_col_t::same_type() instead.
dtype_get_charset_coll(): Narrow the return type to uint16_t.
This is a refined version of a fix that was developed by
Thirunarayanan Balathandayuthapani.
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index 605480461f1..aad5314a973 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -3,7 +3,7 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2018, MariaDB Corporation. + Copyright (c) 2008, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -164,6 +164,10 @@ public: { swap_variables(CHARSET_INFO*, m_charset, other.m_charset); } + bool same_encoding(const Charset &other) const + { + return !strcmp(m_charset->csname, other.m_charset->csname); + } /* Collation name without the character set name. For example, in case of "latin1_swedish_ci", |