summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-22 21:12:48 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-22 21:12:48 +0300
commitd9d9c30b707d7634503c8d3bce7dab7f7ec3fd34 (patch)
treedd112cca32b4cbc18980788ad591a61b41add71e /sql/item_strfunc.h
parentfde3d895d9dca494be9fa077835fb2f606a5f3d0 (diff)
parent9d0ee2dcb72c011b4ee73c578cc32b666297ca31 (diff)
downloadmariadb-git-d9d9c30b707d7634503c8d3bce7dab7f7ec3fd34.tar.gz
Merge 10.2 into 10.3
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 a279dd8598f..c0505773ba8 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1441,11 +1441,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(); }