summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-04-19 15:18:38 +0400
committerAlexander Barkov <bar@mariadb.com>2019-05-16 16:20:25 +0400
commitc59d6395a602f412810cfd1d13a2ffa3f228cc0c (patch)
tree9c4d599ff63e07c24c67bb364be0ad8560b9f41a /sql/sql_string.h
parent9aa80fcf466434d45374be789c68487bada49bc0 (diff)
downloadmariadb-git-c59d6395a602f412810cfd1d13a2ffa3f228cc0c.tar.gz
A joint patch for MDEV-19284 and MDEV-19285 (INSTANT ALTER)
This patch fixes: - MDEV-19284 INSTANT ALTER with ucs2-to-utf16 conversion produces bad data - MDEV-19285 INSTANT ALTER from ascii_general_ci to latin1_general_ci produces corrupt data These regressions were introduced in 10.4.3 by: - MDEV-15564 Avoid table rebuild in ALTER TABLE on collation or charset changes Changes: 1. Cleanup: Adding a helper method Field_longstr::csinfo_change_allows_instant_alter(), to remove some duplicate code in field.cc. 2. Cleanup: removing Type_handler::Charsets_are_compatible() and static function charsets_are_compatible() and introducing new methods in the recently added class Charset instead: - encoding_allows_reinterpret_as() - encoding_and_order_allow_reinterpret_as() 3. Bug fix: Removing the code that allowed instant conversion for ascii-to->8bit and ucs2-to->utf16. This actually fixes MDEV-19284 and MDEV-19285. 4. Bug fix: Adding a helper method Charset::collation_specific_name(). The old corresponding code in Type_handler::Charsets_are_compatible() was not safe against (badly named) user-defined collations whose character set name can be longer than collation name.
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 39555020696..9f113d8ef6c 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -159,6 +159,14 @@ public:
{
swap_variables(CHARSET_INFO*, m_charset, other.m_charset);
}
+ /*
+ Collation name without the character set name.
+ For example, in case of "latin1_swedish_ci",
+ this method returns "_swedish_ci".
+ */
+ LEX_CSTRING collation_specific_name() const;
+ bool encoding_allows_reinterpret_as(CHARSET_INFO *cs) const;
+ bool encoding_and_order_allow_reinterpret_as(CHARSET_INFO *cs) const;
};