summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-22 15:21:43 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-22 15:21:43 +0300
commit9d0ee2dcb72c011b4ee73c578cc32b666297ca31 (patch)
tree87992f23022a4fdd0e722ced5388e0fe0ea1a5e9 /sql/item_strfunc.h
parent78efa1093076307946873f322b45a14d1ed5ffb0 (diff)
parent4c19227929b0d86616337585fb95a4bb8fe0d4b2 (diff)
downloadmariadb-git-9d0ee2dcb72c011b4ee73c578cc32b666297ca31.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index df8761534a1..0bf21b63ac9 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1198,11 +1198,19 @@ public:
/*
Conversion from and to "binary" is safe.
Conversion to Unicode is safe.
+ Conversion from an expression with the ASCII repertoire
+ to any character set that can store characters U+0000..U+007F
+ is safe:
+ - All supported multibyte character sets can store U+0000..U+007F
+ - All supported 7bit character sets can store U+0000..U+007F
+ except those marked with MY_CS_NONASCII (e.g. swe7).
Other kind of conversions are potentially lossy.
*/
safe= (args[0]->collation.collation == &my_charset_bin ||
cs == &my_charset_bin ||
- (cs->state & MY_CS_UNICODE));
+ (cs->state & MY_CS_UNICODE) ||
+ (args[0]->collation.repertoire == MY_REPERTOIRE_ASCII &&
+ (cs->mbmaxlen > 1 || !(cs->state & MY_CS_NONASCII))));
}
}
bool is_json_type() { return args[0]->is_json_type(); }