diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-09-06 12:50:02 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-09-06 12:50:02 +0400 |
commit | ee19806b8e6bb00fa1cd547fe3e75193859d300d (patch) | |
tree | 27568e9cc17e2717785af028c65deb912731bfb9 | |
parent | e4f6fd5e1252f8c68f449fe820bae88c18bca8f5 (diff) | |
download | mariadb-git-ee19806b8e6bb00fa1cd547fe3e75193859d300d.tar.gz |
MDEV-9711 NO PAD collations
Based on the patch from Daniil Medvedev (a Google Summer of Code task)
72 files changed, 28253 insertions, 345 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index 796dd630aa7..9812e9fa2eb 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -362,6 +362,8 @@ struct my_collation_handler_st extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; +extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler; +extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler; extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; /* Some typedef to make it easy for C++ to make function pointers */ @@ -585,49 +587,81 @@ struct charset_info_st extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_bin; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1; +extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_ci; extern struct charset_info_st my_charset_big5_bin; extern struct charset_info_st my_charset_big5_chinese_ci; +extern struct charset_info_st my_charset_big5_nopad_bin; +extern struct charset_info_st my_charset_big5_chinese_nopad_ci; extern struct charset_info_st my_charset_cp1250_czech_ci; extern struct charset_info_st my_charset_cp932_bin; extern struct charset_info_st my_charset_cp932_japanese_ci; +extern struct charset_info_st my_charset_cp932_nopad_bin; +extern struct charset_info_st my_charset_cp932_japanese_nopad_ci; extern struct charset_info_st my_charset_eucjpms_bin; extern struct charset_info_st my_charset_eucjpms_japanese_ci; +extern struct charset_info_st my_charset_eucjpms_nopad_bin; +extern struct charset_info_st my_charset_eucjpms_japanese_nopad_ci; extern struct charset_info_st my_charset_euckr_bin; extern struct charset_info_st my_charset_euckr_korean_ci; +extern struct charset_info_st my_charset_euckr_nopad_bin; +extern struct charset_info_st my_charset_euckr_korean_nopad_ci; extern struct charset_info_st my_charset_gb2312_bin; extern struct charset_info_st my_charset_gb2312_chinese_ci; +extern struct charset_info_st my_charset_gb2312_nopad_bin; +extern struct charset_info_st my_charset_gb2312_chinese_nopad_ci; extern struct charset_info_st my_charset_gbk_bin; extern struct charset_info_st my_charset_gbk_chinese_ci; +extern struct charset_info_st my_charset_gbk_nopad_bin; +extern struct charset_info_st my_charset_gbk_chinese_nopad_ci; extern struct charset_info_st my_charset_latin1_bin; +extern struct charset_info_st my_charset_latin1_nopad_bin; extern struct charset_info_st my_charset_latin1_german2_ci; extern struct charset_info_st my_charset_latin2_czech_ci; extern struct charset_info_st my_charset_sjis_bin; extern struct charset_info_st my_charset_sjis_japanese_ci; +extern struct charset_info_st my_charset_sjis_nopad_bin; +extern struct charset_info_st my_charset_sjis_japanese_nopad_ci; extern struct charset_info_st my_charset_tis620_bin; extern struct charset_info_st my_charset_tis620_thai_ci; +extern struct charset_info_st my_charset_tis620_nopad_bin; +extern struct charset_info_st my_charset_tis620_thai_nopad_ci; extern struct charset_info_st my_charset_ucs2_bin; extern struct charset_info_st my_charset_ucs2_general_ci; +extern struct charset_info_st my_charset_ucs2_nopad_bin; +extern struct charset_info_st my_charset_ucs2_general_nopad_ci; extern struct charset_info_st my_charset_ucs2_general_mysql500_ci; extern struct charset_info_st my_charset_ucs2_unicode_ci; extern struct charset_info_st my_charset_ucs2_general_mysql500_ci; extern struct charset_info_st my_charset_ujis_bin; extern struct charset_info_st my_charset_ujis_japanese_ci; +extern struct charset_info_st my_charset_ujis_nopad_bin; +extern struct charset_info_st my_charset_ujis_japanese_nopad_ci; extern struct charset_info_st my_charset_utf16_bin; extern struct charset_info_st my_charset_utf16_general_ci; extern struct charset_info_st my_charset_utf16_unicode_ci; extern struct charset_info_st my_charset_utf16le_bin; extern struct charset_info_st my_charset_utf16le_general_ci; +extern struct charset_info_st my_charset_utf16_general_nopad_ci; +extern struct charset_info_st my_charset_utf16_nopad_bin; +extern struct charset_info_st my_charset_utf16le_nopad_bin; +extern struct charset_info_st my_charset_utf16le_general_nopad_ci; extern struct charset_info_st my_charset_utf32_bin; extern struct charset_info_st my_charset_utf32_general_ci; extern struct charset_info_st my_charset_utf32_unicode_ci; +extern struct charset_info_st my_charset_utf32_nopad_bin; +extern struct charset_info_st my_charset_utf32_general_nopad_ci; extern struct charset_info_st my_charset_utf8_bin; +extern struct charset_info_st my_charset_utf8_nopad_bin; +extern struct charset_info_st my_charset_utf8_general_nopad_ci; extern struct charset_info_st my_charset_utf8_general_mysql500_ci; extern struct charset_info_st my_charset_utf8_unicode_ci; extern struct charset_info_st my_charset_utf8mb4_bin; extern struct charset_info_st my_charset_utf8mb4_general_ci; +extern struct charset_info_st my_charset_utf8mb4_nopad_bin; +extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci; extern struct charset_info_st my_charset_utf8mb4_unicode_ci; #define MY_UTF8MB3 "utf8" @@ -653,6 +687,11 @@ extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t, extern void my_hash_sort_simple(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); + +extern void my_hash_sort_simple_nopad(CHARSET_INFO *cs, + const uchar *key, size_t len, + ulong *nr1, ulong *nr2); + extern void my_hash_sort_bin(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); @@ -824,18 +863,38 @@ int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2); +void my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len, + ulong *nr1, ulong *nr2); + size_t my_strnxfrm_mb(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); +size_t my_strnxfrm_mb_nopad(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + size_t my_strnxfrm_unicode(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); + +size_t my_strnxfrm_unicode_nopad(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + size_t my_strnxfrmlen_unicode(CHARSET_INFO *, size_t); size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); + uchar *dst, size_t dstlen, + uint nweights, const uchar *src, + size_t srclen, uint flags); + +size_t my_strnxfrm_unicode_full_nopad_bin(CHARSET_INFO *, + uchar *dst, size_t dstlen, + uint nweights, const uchar *src, + size_t srclen, uint flags); + size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *, size_t); int my_wildcmp_unicode(CHARSET_INFO *cs, @@ -873,6 +932,10 @@ void my_strxfrm_desc_and_reverse(uchar *str, uchar *strend, size_t my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, uchar *str, uchar *frmend, uchar *strend, uint nweights, uint flags, uint level); +size_t my_strxfrm_pad_desc_and_reverse_nopad(CHARSET_INFO *cs, + uchar *str, uchar *frmend, + uchar *strend, uint nweights, + uint flags, uint level); const MY_CONTRACTIONS *my_charset_get_contractions(CHARSET_INFO *cs, int level); diff --git a/mysql-test/include/ctype_pad.inc b/mysql-test/include/ctype_pad.inc new file mode 100644 index 00000000000..4cefc575cdd --- /dev/null +++ b/mysql-test/include/ctype_pad.inc @@ -0,0 +1,79 @@ +--echo # +--echo # Start of ctype_pad.inc +--echo # + +--echo # +--echo # Unique indexes +--echo # + +eval CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE $coll; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; + +--echo # +--echo # UNION +--echo # + +eval CREATE TABLE t2 (a VARCHAR(10)) COLLATE $coll; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +DROP TABLE t1; +DROP TABLE t2; + +--echo # +--echo # DISTINCT, COUNT, MAX +--echo # + +eval CREATE TABLE t1 (a VARCHAR(10)) COLLATE $coll; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +SELECT HEX(MAX(a)), MAX(a) FROM t1; + +--echo # +--echo # GROUP BY +--echo # + +eval CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE $coll; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +DROP TABLE t2; + +--echo # +--echo # Weights +--echo # + +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +DROP TABLE t1; + +--echo # +--echo # IF, CASE, LEAST +--echo # + +eval SELECT IF('abc' COLLATE $coll = 'abc ', 'pad', 'nopad'); +eval SELECT CASE 'abc' COLLATE $coll WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +eval SELECT CASE WHEN 'abc' COLLATE $coll = 'abc ' THEN 'pad' ELSE 'nopad' END; +eval SELECT HEX(LEAST('abc ' COLLATE $coll, 'abc ')); +eval SELECT HEX(GREATEST('abc ' COLLATE $coll, 'abc ')); + +--echo # +--echo # Collation mix +--echo # + +eval CREATE TABLE t1 (a VARCHAR(10)) COLLATE $coll_pad; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +eval SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE $coll_pad; +eval SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE $coll; +eval ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE $coll; +SELECT COUNT(*) FROM t1 WHERE a='a'; +eval SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE $coll_pad; +eval SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE $coll; +DROP TABLE t1; + +--echo # +--echo # End of ctype_pad.inc +--echo # diff --git a/mysql-test/include/ctype_pad_all_engines.inc b/mysql-test/include/ctype_pad_all_engines.inc new file mode 100644 index 00000000000..29371676a19 --- /dev/null +++ b/mysql-test/include/ctype_pad_all_engines.inc @@ -0,0 +1,7 @@ +SET STORAGE_ENGINE=MyISAM; +--source include/ctype_pad.inc + +SET STORAGE_ENGINE=HEAP; +--source include/ctype_pad.inc + +SET STORAGE_ENGINE=Default; diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index ff6b17f5b4d..43cac266bf3 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -4830,3 +4830,567 @@ DROP TABLE t1; # # End of 10.0 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=big5; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE big5_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE big5_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result index 4b170ee4c9b..eb714e9f8d7 100644 --- a/mysql-test/r/ctype_cp932.result +++ b/mysql-test/r/ctype_cp932.result @@ -33,3 +33,567 @@ DROP TABLE t1; SET @@character_set_client= @old_character_set_client; SET @@character_set_connection= @old_character_set_connection; SET @@character_set_results= @old_character_set_results; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=cp932; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp932_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp932 COLLATE=cp932_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp932_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp932 COLLATE=cp932_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp932_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp932 COLLATE=cp932_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp932_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp932 COLLATE=cp932_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result index 8d4d8f6d5f9..b40787992bf 100644 --- a/mysql-test/r/ctype_eucjpms.result +++ b/mysql-test/r/ctype_eucjpms.result @@ -33914,7 +33914,7 @@ DROP TABLE t1; # End of 10.1 tests # # -# End of 10.2 tests +# Start of 10.2 tests # # # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis @@ -33932,5 +33932,563 @@ HEX(a) 3F3F DROP TABLE t1; # +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=eucjpms; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE eucjpms_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=eucjpms COLLATE=eucjpms_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE eucjpms_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=eucjpms COLLATE=eucjpms_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE eucjpms_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=eucjpms COLLATE=eucjpms_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE eucjpms_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=eucjpms COLLATE=eucjpms_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result index 90353c6af2a..359984d1e51 100644 --- a/mysql-test/r/ctype_euckr.result +++ b/mysql-test/r/ctype_euckr.result @@ -25428,3 +25428,567 @@ A1A1A1A1A1A120202020202020202020202020202020202020 # # End of 5.6 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=euckr; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_korean_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE euckr_korean_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_korean_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_korean_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_korean_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_korean_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE euckr_korean_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=euckr COLLATE=euckr_korean_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_korean_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_korean_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE euckr_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE euckr_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=euckr COLLATE=euckr_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result index f9f37c00a79..4702eac6b6b 100644 --- a/mysql-test/r/ctype_gb2312.result +++ b/mysql-test/r/ctype_gb2312.result @@ -4525,3 +4525,567 @@ DROP TABLE allbytes; # # End of 10.0 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=gb2312; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gb2312_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gb2312_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gb2312_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gb2312_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=gb2312 COLLATE=gb2312_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index e454347592c..34c3f6c7486 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -5945,5 +5945,563 @@ HEX(a) B042 DROP TABLE t1; # +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=gbk; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gbk_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gbk_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=gbk COLLATE=gbk_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gbk_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE gbk_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=gbk COLLATE=gbk_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index b0bcc5d7bd2..5ed8e9e8868 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -8222,3 +8222,567 @@ DROP TABLE t1; # # End of 10.1 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=latin1; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result index cc5d0b23316..12a03a872e0 100644 --- a/mysql-test/r/ctype_ldml.result +++ b/mysql-test/r/ctype_ldml.result @@ -454,17 +454,20 @@ select "foo" = "foo " collate latin1_test; The following tests check that two-byte collation IDs work select * from information_schema.collations where id>256 and is_compiled<>'Yes' order by id; COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN +ascii2_general_nopad_ci ascii2 318 1 ascii2_bin2 ascii2 319 1 ascii2_general_ci ascii2 320 Yes 1 ascii2_bin ascii2 321 1 ascii2_general_inherited_ci ascii2 322 1 ascii2_general_inherited2_ci ascii2 323 1 ascii2_badly_inherited_ci ascii2 324 1 +ascii2_nopad_bin ascii2 325 1 utf8mb4_test_ci utf8mb4 326 8 utf16_test_ci utf16 327 8 utf8mb4_test_400_ci utf8mb4 328 8 latin1_test2 latin1 332 1 latin1_test2_cs latin1 333 1 +latin1_swedish_nopad2_ci latin1 334 1 utf8_bengali_standard_ci utf8 336 8 utf8_bengali_traditional_ci utf8 337 8 utf8_implicit_weights_ci utf8 338 8 @@ -1260,3 +1263,29 @@ SELECT * FROM t1 WHERE a RLIKE 'a'; a a DROP TABLE t1; +# +# MDEV-9711 NO PAD collations +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_nopad_ci); +INSERT INTO t1 VALUES ('a'),('a '),('A'),('A '); +SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1; +a a='a' a='a ' HEX(a) LOWER(a) UPPER(a) CONVERT(a USING utf8) +a 1 0 61 a A a +a 0 1 6120 a A a +A 1 0 41 a A A +A 0 1 4120 a A A +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_nopad_bin; +SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1; +a a='a' a='a ' HEX(a) LOWER(a) UPPER(a) CONVERT(a USING utf8) +a 1 0 61 a A a +a 0 1 6120 a A a +A 0 0 41 a A A +A 0 0 4120 a A A +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad2_ci; +SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1; +a a='a' a='a ' HEX(a) LOWER(a) UPPER(a) CONVERT(a USING utf8) +a 1 0 61 a A a +a 0 1 6120 a A a +A 1 0 41 a A A +A 0 1 4120 a A A +DROP TABLE t1; diff --git a/mysql-test/r/ctype_nopad_8bit.result b/mysql-test/r/ctype_nopad_8bit.result new file mode 100644 index 00000000000..b5dadc2f5da --- /dev/null +++ b/mysql-test/r/ctype_nopad_8bit.result @@ -0,0 +1,12771 @@ +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=dec8; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE dec8_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=dec8 COLLATE=dec8_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE dec8_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=dec8 COLLATE=dec8_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE dec8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=dec8 COLLATE=dec8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE dec8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=dec8 COLLATE=dec8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp850; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp850_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp850 COLLATE=cp850_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp850_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp850 COLLATE=cp850_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp850_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp850 COLLATE=cp850_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp850_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp850 COLLATE=cp850_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=hp8; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_english_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hp8_english_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=hp8 COLLATE=hp8_english_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_english_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_english_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_english_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hp8_english_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=hp8 COLLATE=hp8_english_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_english_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_english_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hp8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=hp8 COLLATE=hp8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hp8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=hp8 COLLATE=hp8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=koi8r; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8r_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8r_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=koi8r COLLATE=koi8r_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8r_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8r_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=koi8r COLLATE=koi8r_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=latin2; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin2 COLLATE=latin2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin2 COLLATE=latin2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=swe7; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE swe7_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE swe7_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=ascii; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ascii_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ascii_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ascii COLLATE=ascii_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ascii_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ascii_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ascii COLLATE=ascii_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=hebrew; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hebrew_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=hebrew COLLATE=hebrew_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hebrew_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=hebrew COLLATE=hebrew_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hebrew_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=hebrew COLLATE=hebrew_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE hebrew_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=hebrew COLLATE=hebrew_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=koi8u; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8u_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=koi8u COLLATE=koi8u_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8u_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=koi8u COLLATE=koi8u_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8u_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=koi8u COLLATE=koi8u_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE koi8u_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=koi8u COLLATE=koi8u_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=greek; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE greek_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=greek COLLATE=greek_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE greek_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=greek COLLATE=greek_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE greek_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=greek COLLATE=greek_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE greek_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=greek COLLATE=greek_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp1250; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1250_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1250_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1250_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1250_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1250 COLLATE=cp1250_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp1257; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1257_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1257 COLLATE=cp1257_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1257_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1257 COLLATE=cp1257_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1257_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1257 COLLATE=cp1257_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1257_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1257 COLLATE=cp1257_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=latin5; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_turkish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin5_turkish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_turkish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_turkish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_turkish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin5_turkish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_turkish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_turkish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin5_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin5_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin5 COLLATE=latin5_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=armscii8; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE armscii8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=armscii8 COLLATE=armscii8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE armscii8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=armscii8 COLLATE=armscii8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE armscii8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=armscii8 COLLATE=armscii8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE armscii8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=armscii8 COLLATE=armscii8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp866; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp866_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp866 COLLATE=cp866_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp866_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp866 COLLATE=cp866_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp866_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp866 COLLATE=cp866_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp866_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp866 COLLATE=cp866_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=keybcs2; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE keybcs2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE keybcs2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE keybcs2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE keybcs2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=macce; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macce_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=macce COLLATE=macce_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macce_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=macce COLLATE=macce_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macce_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=macce COLLATE=macce_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macce_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=macce COLLATE=macce_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=macroman; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macroman_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=macroman COLLATE=macroman_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macroman_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=macroman COLLATE=macroman_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macroman_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=macroman COLLATE=macroman_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE macroman_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=macroman COLLATE=macroman_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp852; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp852_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp852 COLLATE=cp852_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp852_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp852 COLLATE=cp852_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp852_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp852 COLLATE=cp852_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp852_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp852 COLLATE=cp852_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=latin7; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin7_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +86000000000000000000 +86303000000000000000 +30860000000000000000 +30863000000000000000 +86303030000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin7_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin7 COLLATE=latin7_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +86000000000000000000 +86303000000000000000 +30860000000000000000 +30863000000000000000 +86303030000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin7_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin7_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin7 COLLATE=latin7_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp1251; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1251_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1251_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1251_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1251_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COLLATE=cp1251_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=cp1256; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1256_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1256 COLLATE=cp1256_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1256_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1256 COLLATE=cp1256_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1256_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=cp1256 COLLATE=cp1256_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE cp1256_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=cp1256 COLLATE=cp1256_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET character_set_connection=geostd8; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE geostd8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=geostd8 COLLATE=geostd8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE geostd8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=geostd8 COLLATE=geostd8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE geostd8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=geostd8 COLLATE=geostd8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE geostd8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=geostd8 COLLATE=geostd8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index e96a54211dc..50938fada63 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -18746,5 +18746,563 @@ a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) 1 DROP TABLE t1; # +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=sjis; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE sjis_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE sjis_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE sjis_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE sjis_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_swe7.result b/mysql-test/r/ctype_swe7.result index ccab77c21d1..8aeb05eaa3b 100644 --- a/mysql-test/r/ctype_swe7.result +++ b/mysql-test/r/ctype_swe7.result @@ -3069,3 +3069,567 @@ DROP TABLE allbytes; # # End of 10.0 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=swe7; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE ?t1? ( + ?a? varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + PRIMARY KEY (?a?) +) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE ?t1? ( + ?a? varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL, + PRIMARY KEY (?a?) +) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE ?t1? ( + ?a? varchar(10) COLLATE swe7_nopad_bin NOT NULL, + PRIMARY KEY (?a?) +) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE ?t1? ( + ?a? varchar(10) COLLATE swe7_nopad_bin NOT NULL, + PRIMARY KEY (?a?) +) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result index f148902953a..fd934600689 100644 --- a/mysql-test/r/ctype_tis620.result +++ b/mysql-test/r/ctype_tis620.result @@ -3847,3 +3847,567 @@ E0 # # End of 5.6 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=tis620; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_thai_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_thai_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 4a6d5fa1b41..0a75b11e064 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -5660,3 +5660,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3' # # End of 10.1 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=ucs2; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index 5eb9a3e1db5..90db3474cef 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -26219,7 +26219,7 @@ DROP TABLE t1; # End of 10.1 tests # # -# End of 10.2 tests +# Start of 10.2 tests # # # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis @@ -26237,5 +26237,563 @@ HEX(a) 3F3F DROP TABLE t1; # +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=ujis; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ujis_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_japanese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ujis_japanese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_japanese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_japanese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ujis_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ujis_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 74e264c375d..09ba94bd12d 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -2201,3 +2201,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3' # # End of 10.1 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=utf16; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result index b93f67b5f6c..1ba2cf600a4 100644 --- a/mysql-test/r/ctype_utf16le.result +++ b/mysql-test/r/ctype_utf16le.result @@ -2393,3 +2393,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3' # # End of 10.1 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=utf16le; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16le_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf16le COLLATE=utf16le_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +61006200630020002000 abc +610062006300 abc +6100200020002000 a +200061002000 a +20006100 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +61002000 a +6100200020002000 a +610062006300 abc +6100620063002000 abc +61006200630020002000 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +6100 a +610020002000 a +6100200020002000 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +6100200020002000 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +61006100 1 +6100610020002000 1 +61006200 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +6100620063002000 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +61006200630020002000 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16le_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf16le COLLATE=utf16le_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +61006200630020002000 abc +610062006300 abc +6100200020002000 a +200061002000 a +20006100 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +61002000 a +6100200020002000 a +610062006300 abc +6100620063002000 abc +61006200630020002000 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +6100 a +610020002000 a +6100200020002000 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +6100200020002000 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +61006100 1 +6100610020002000 1 +61006200 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +6100620063002000 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc ')) +61006200630020002000 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16le_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf16le COLLATE=utf16le_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +61006200630020002000 abc +610062006300 abc +6100200020002000 a +200061002000 a +20006100 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +61002000 a +6100200020002000 a +610062006300 abc +6100620063002000 abc +61006200630020002000 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +6100 a +610020002000 a +6100200020002000 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +6100200020002000 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +61006100 1 +6100610020002000 1 +61006200 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +6100620063002000 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +61006200630020002000 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf16le_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf16le COLLATE=utf16le_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +20006100 a +200061002000 a +6100200020002000 a +610062006300 abc +61006200630020002000 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +61006200630020002000 abc +610062006300 abc +6100200020002000 a +200061002000 a +20006100 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +61002000 a +6100200020002000 a +610062006300 abc +6100620063002000 abc +61006200630020002000 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +20006100 a +200061002000 a +6100 a +610020002000 a +6100200020002000 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +6100200020002000 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +61006100 1 +6100610020002000 1 +61006200 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +6100620063002000 +SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc ')) +61006200630020002000 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 261209b2eec..9d96fa026e6 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -2237,3 +2237,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3' # # End of 10.1 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=utf32; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf32_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +0000006100000062000000630000002000000020 abc +000000610000006200000063 abc +00000061000000200000002000000020 a +000000200000006100000020 a +0000002000000061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +0000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +00000061000000620000006300000020 abc +0000006100000062000000630000002000000020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061 a +000000610000002000000020 a +00000061000000200000002000000020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +00000061000000200000002000000020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +0000006100000061 1 +00000061000000610000002000000020 1 +0000006100000062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +00000061000000620000006300000020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +0000006100000062000000630000002000000020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf32_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +0000006100000062000000630000002000000020 abc +000000610000006200000063 abc +00000061000000200000002000000020 a +000000200000006100000020 a +0000002000000061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +0000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +00000061000000620000006300000020 abc +0000006100000062000000630000002000000020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061 a +000000610000002000000020 a +00000061000000200000002000000020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +00000061000000200000002000000020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +0000006100000061 1 +00000061000000610000002000000020 1 +0000006100000062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +00000061000000620000006300000020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc ')) +0000006100000062000000630000002000000020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf32_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +0000006100000062000000630000002000000020 abc +000000610000006200000063 abc +00000061000000200000002000000020 a +000000200000006100000020 a +0000002000000061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +0000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +00000061000000620000006300000020 abc +0000006100000062000000630000002000000020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061 a +000000610000002000000020 a +00000061000000200000002000000020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +00000061000000200000002000000020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +0000006100000061 1 +00000061000000610000002000000020 1 +0000006100000062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +00000061000000620000006300000020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +0000006100000062000000630000002000000020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf32_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +0000006100000062000000630000002000000020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +0000006100000062000000630000002000000020 abc +000000610000006200000063 abc +00000061000000200000002000000020 a +000000200000006100000020 a +0000002000000061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +0000006100000020 a +00000061000000200000002000000020 a +000000610000006200000063 abc +00000061000000620000006300000020 abc +0000006100000062000000630000002000000020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +0000002000000061 a +000000200000006100000020 a +00000061 a +000000610000002000000020 a +00000061000000200000002000000020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +00000061000000200000002000000020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +0000006100000061 1 +00000061000000610000002000000020 1 +0000006100000062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +00000061000000620000006300000020 +SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc ')) +0000006100000062000000630000002000000020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index a9c4f2d754f..5e76aa2c203 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -10583,5 +10583,562 @@ HEX(a) C39F DROP TABLE t1; # +# MDEV-9711 NO PAD Collatons +# +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# # End of 10.2 tests # diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 67b659e25b4..c75b76964a2 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -3457,5 +3457,562 @@ F09F988E 3F3F3F DROP TABLE t1; # +# MDEV-9711 NO PAD Collatons +# +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8mb4_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8mb4_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8mb4_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8mb4_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +000061000000000000000000000000000000000000000000000000000000 +000061000020000020000000000000000000000000000000000000000000 +000020000061000000000000000000000000000000000000000000000000 +000020000061000020000000000000000000000000000000000000000000 +000061000020000020000020000000000000000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# # End of 10.2 tests # diff --git a/mysql-test/std_data/ldml/Index.xml b/mysql-test/std_data/ldml/Index.xml index 8a59517069d..bf1b3e82bbf 100644 --- a/mysql-test/std_data/ldml/Index.xml +++ b/mysql-test/std_data/ldml/Index.xml @@ -328,6 +328,11 @@ - ascii2_general_inherited_ci inherits sort order in ascii2.xml - ascii2_genegal_inherited2_ci inherits sort order directly in this file. --> + <collation name="ascii2_general_nopad_ci" id="318" flag="nopad"> + <rules> + <import source="ascii2_general_ci"/> + </rules> + </collation> <collation name="ascii2_bin2" id="319" flag="binary"/> <collation name="ascii2_general_ci" id="320" flag="primary"/> <collation name="ascii2_bin" id="321" flag="binary"/> @@ -342,6 +347,7 @@ <import source="ascii2_non_existing_ci"/> </rules> </collation> + <collation name="ascii2_nopad_bin" id="325" flag="binary" flag="nopad"/> </charset> <charset name="latin1"> @@ -357,6 +363,11 @@ <collation name="latin1_test" id="99" order="test"/> <collation name="latin1_test2" id="332" order="test"/> <collation name="latin1_test2_cs" id="333"/> + <collation name="latin1_swedish_nopad2_ci" id="334" flag="nopad"> + <rules> + <import source="latin1_swedish_ci"/> + </rules> + </collation> </charset> <charset name="utf8"> diff --git a/mysql-test/suite/innodb/r/innodb_ctype_big5.result b/mysql-test/suite/innodb/r/innodb_ctype_big5.result new file mode 100644 index 00000000000..3ff2eed2b25 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_big5.result @@ -0,0 +1,285 @@ +SET STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET NAMES big5; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_chinese_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_chinese_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE big5_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_latin1.result b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result new file mode 100644 index 00000000000..5818964328f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_latin1.result @@ -0,0 +1,285 @@ +SET STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET NAMES latin1; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result index 3cb307084f5..a4ee090020d 100644 --- a/mysql-test/suite/innodb/r/innodb_ctype_ldml.result +++ b/mysql-test/suite/innodb/r/innodb_ctype_ldml.result @@ -390,17 +390,20 @@ select "foo" = "foo " collate latin1_test; The following tests check that two-byte collation IDs work select * from information_schema.collations where id>256 and is_compiled<>'Yes' order by id; COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN +ascii2_general_nopad_ci ascii2 318 1 ascii2_bin2 ascii2 319 1 ascii2_general_ci ascii2 320 Yes 1 ascii2_bin ascii2 321 1 ascii2_general_inherited_ci ascii2 322 1 ascii2_general_inherited2_ci ascii2 323 1 ascii2_badly_inherited_ci ascii2 324 1 +ascii2_nopad_bin ascii2 325 1 utf8mb4_test_ci utf8mb4 326 8 utf16_test_ci utf16 327 8 utf8mb4_test_400_ci utf8mb4 328 8 latin1_test2 latin1 332 1 latin1_test2_cs latin1 333 1 +latin1_swedish_nopad2_ci latin1 334 1 utf8_bengali_standard_ci utf8 336 8 utf8_bengali_traditional_ci utf8 337 8 utf8_implicit_weights_ci utf8 338 8 diff --git a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result new file mode 100644 index 00000000000..360a4192ee7 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result @@ -0,0 +1,285 @@ +SET STORAGE_ENGINE=InnoDB; +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET NAMES utf8; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +# +# End of 10.2 tests +# diff --git a/mysql-test/suite/innodb/t/innodb_ctype_big5.test b/mysql-test/suite/innodb/t/innodb_ctype_big5.test new file mode 100644 index 00000000000..684a97983e5 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_ctype_big5.test @@ -0,0 +1,25 @@ +--source include/have_innodb.inc +--source include/have_big5.inc + +SET STORAGE_ENGINE=InnoDB; + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # + +SET NAMES big5; +let $coll='big5_chinese_nopad_ci'; +let $coll_pad='big5_chinese_ci'; +--source include/ctype_pad.inc + +let $coll='big5_nopad_bin'; +let $coll_pad='big5_bin'; +--source include/ctype_pad.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/suite/innodb/t/innodb_ctype_latin1.test b/mysql-test/suite/innodb/t/innodb_ctype_latin1.test new file mode 100644 index 00000000000..0f88ae3212d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_ctype_latin1.test @@ -0,0 +1,25 @@ +--source include/have_innodb.inc + +SET STORAGE_ENGINE=InnoDB; + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # + +SET NAMES latin1; + +let $coll='latin1_swedish_nopad_ci'; +let $coll_pad='latin1_swedish_ci'; +--source include/ctype_pad.inc + +let $coll='latin1_nopad_bin'; +let $coll_pad='latin1_bin'; +--source include/ctype_pad.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/suite/innodb/t/innodb_ctype_utf8.test b/mysql-test/suite/innodb/t/innodb_ctype_utf8.test new file mode 100644 index 00000000000..105f771d8b3 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_ctype_utf8.test @@ -0,0 +1,25 @@ +--source include/have_innodb.inc + +SET STORAGE_ENGINE=InnoDB; + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # + +SET NAMES utf8; + +let $coll='utf8_general_nopad_ci'; +let $coll_pad='utf8_general_ci'; +--source include/ctype_pad.inc + +let $coll='utf8_nopad_bin'; +let $coll_pad='utf8_bin'; +--source include/ctype_pad.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index 629db68f62f..fe29f769a89 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -249,3 +249,23 @@ DROP TABLE t1; --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=big5; +let $coll='big5_chinese_nopad_ci'; +let $coll_pad='big5_chinese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='big5_nopad_bin'; +let $coll_pad='big5_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test index 96a2666f69b..2486ca8a79e 100644 --- a/mysql-test/t/ctype_cp932.test +++ b/mysql-test/t/ctype_cp932.test @@ -27,3 +27,23 @@ DROP TABLE t1; SET @@character_set_client= @old_character_set_client; SET @@character_set_connection= @old_character_set_connection; SET @@character_set_results= @old_character_set_results; + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=cp932; +let $coll='cp932_japanese_nopad_ci'; +let $coll_pad='cp932_japanese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp932_nopad_bin'; +let $coll_pad='cp932_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test index b5bd92d1d07..bda4cec61cc 100644 --- a/mysql-test/t/ctype_eucjpms.test +++ b/mysql-test/t/ctype_eucjpms.test @@ -568,7 +568,7 @@ DROP TABLE t1; --echo # --echo # ---echo # End of 10.2 tests +--echo # Start of 10.2 tests --echo # --echo # @@ -580,5 +580,17 @@ SELECT HEX(a) FROM t1; DROP TABLE t1; --echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=eucjpms; +let $coll='eucjpms_japanese_nopad_ci'; +let $coll_pad='eucjpms_japanese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='eucjpms_nopad_bin'; +let $coll_pad='eucjpms_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/ctype_euckr.test b/mysql-test/t/ctype_euckr.test index 33b3e96cba8..b0b1569e540 100644 --- a/mysql-test/t/ctype_euckr.test +++ b/mysql-test/t/ctype_euckr.test @@ -197,3 +197,23 @@ set collation_connection=euckr_bin; --echo # End of 5.6 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=euckr; +let $coll='euckr_korean_nopad_ci'; +let $coll_pad='euckr_korean_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='euckr_nopad_bin'; +let $coll_pad='euckr_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_gb2312.test b/mysql-test/t/ctype_gb2312.test index 3ca6941705c..8f15f72fad5 100644 --- a/mysql-test/t/ctype_gb2312.test +++ b/mysql-test/t/ctype_gb2312.test @@ -160,3 +160,23 @@ let $ctype_unescape_combinations=selected; --echo # --echo # End of 10.0 tests --echo # + + +--echo # +--echo # Start of 10.2 tests +--echo # +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=gb2312; +let $coll='gb2312_chinese_nopad_ci'; +let $coll_pad='gb2312_chinese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='gb2312_nopad_bin'; +let $coll_pad='gb2312_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test index ae66dbba4b5..88bfda46748 100644 --- a/mysql-test/t/ctype_gbk.test +++ b/mysql-test/t/ctype_gbk.test @@ -450,6 +450,17 @@ DELETE FROM t1; LOAD DATA INFILE '../../std_data/loaddata/mdev8711.txt' INTO TABLE t1 CHARACTER SET gbk LINES TERMINATED BY '@' IGNORE 1 LINES; SELECT HEX(a) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=gbk; +let $coll='gbk_chinese_nopad_ci'; +let $coll_pad='gbk_chinese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='gbk_nopad_bin'; +let $coll_pad='gbk_bin'; +--source include/ctype_pad_all_engines.inc --echo # --echo # End of 10.2 tests diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index d82a5b88418..78d5f819f57 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -378,3 +378,23 @@ DROP TABLE t1; --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=latin1; +let $coll='latin1_swedish_nopad_ci'; +let $coll_pad='latin1_swedish_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='latin1_nopad_bin'; +let $coll_pad='latin1_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test index 401b21fe55a..e511d7aefc8 100644 --- a/mysql-test/t/ctype_ldml.test +++ b/mysql-test/t/ctype_ldml.test @@ -470,3 +470,15 @@ INSERT INTO t1 VALUES ('a'),('A'); # should be case sensitive SELECT * FROM t1 WHERE a RLIKE 'a'; DROP TABLE t1; + +--echo # +--echo # MDEV-9711 NO PAD collations +--echo # +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_nopad_ci); +INSERT INTO t1 VALUES ('a'),('a '),('A'),('A '); +SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_nopad_bin; +SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad2_ci; +SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/ctype_nopad_8bit.test b/mysql-test/t/ctype_nopad_8bit.test new file mode 100644 index 00000000000..fc60bbd7759 --- /dev/null +++ b/mysql-test/t/ctype_nopad_8bit.test @@ -0,0 +1,239 @@ +# +# Tests with the nopad 8 bit character sets +# + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=dec8; +let $coll='dec8_swedish_nopad_ci'; +let $coll_pad='dec8_swedish_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='dec8_nopad_bin'; +let $coll_pad='dec8_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp850; +let $coll='cp850_general_nopad_ci'; +let $coll_pad='cp850_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp850_nopad_bin'; +let $coll_pad='cp850_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=hp8; +let $coll='hp8_english_nopad_ci'; +let $coll_pad='hp8_english_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='hp8_nopad_bin'; +let $coll_pad='hp8_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=koi8r; +let $coll='koi8r_general_nopad_ci'; +let $coll_pad='koi8r_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='koi8r_nopad_bin'; +let $coll_pad='koi8r_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=latin2; +let $coll='latin2_general_nopad_ci'; +let $coll_pad='latin2_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='latin2_nopad_bin'; +let $coll_pad='latin2_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=swe7; +let $coll='swe7_swedish_nopad_ci'; +let $coll_pad='swe7_swedish_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='swe7_nopad_bin'; +let $coll_pad='swe7_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=ascii; +let $coll='ascii_general_nopad_ci'; +let $coll_pad='ascii_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='ascii_nopad_bin'; +let $coll_pad='ascii_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=hebrew; +let $coll='hebrew_general_nopad_ci'; +let $coll_pad='hebrew_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='hebrew_nopad_bin'; +let $coll_pad='hebrew_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=koi8u; +let $coll='koi8u_general_nopad_ci'; +let $coll_pad='koi8u_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='koi8u_nopad_bin'; +let $coll_pad='koi8u_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=greek; +let $coll='greek_general_nopad_ci'; +let $coll_pad='greek_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='greek_nopad_bin'; +let $coll_pad='greek_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp1250; +let $coll='cp1250_general_nopad_ci'; +let $coll_pad='cp1250_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp1250_nopad_bin'; +let $coll_pad='cp1250_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp1257; +let $coll='cp1257_general_nopad_ci'; +let $coll_pad='cp1257_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp1257_nopad_bin'; +let $coll_pad='cp1257_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=latin5; +let $coll='latin5_turkish_nopad_ci'; +let $coll_pad='latin5_turkish_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='latin5_nopad_bin'; +let $coll_pad='latin5_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=armscii8; +let $coll='armscii8_general_nopad_ci'; +let $coll_pad='armscii8_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='armscii8_nopad_bin'; +let $coll_pad='armscii8_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp866; +let $coll='cp866_general_nopad_ci'; +let $coll_pad='cp866_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp866_nopad_bin'; +let $coll_pad='cp866_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=keybcs2; +let $coll='keybcs2_general_nopad_ci'; +let $coll_pad='keybcs2_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='keybcs2_nopad_bin'; +let $coll_pad='keybcs2_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=macce; +let $coll='macce_general_nopad_ci'; +let $coll_pad='macce_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='macce_nopad_bin'; +let $coll_pad='macce_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=macroman; +let $coll='macroman_general_nopad_ci'; +let $coll_pad='macroman_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='macroman_nopad_bin'; +let $coll_pad='macroman_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp852; +let $coll='cp852_general_nopad_ci'; +let $coll_pad='cp852_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp852_nopad_bin'; +let $coll_pad='cp852_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=latin7; +let $coll='latin7_general_nopad_ci'; +let $coll_pad='latin7_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='latin7_nopad_bin'; +let $coll_pad='latin7_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp1251; +let $coll='cp1251_general_nopad_ci'; +let $coll_pad='cp1251_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp1251_nopad_bin'; +let $coll_pad='cp1251_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=cp1256; +let $coll='cp1256_general_nopad_ci'; +let $coll_pad='cp1256_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='cp1256_nopad_bin'; +let $coll_pad='cp1256_bin'; +--source include/ctype_pad_all_engines.inc + + +SET character_set_connection=geostd8; +let $coll='geostd8_general_nopad_ci'; +let $coll_pad='geostd8_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='geostd8_nopad_bin'; +let $coll_pad='geostd8_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 5cc7d9a858d..a962f69003d 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -245,6 +245,17 @@ SELECT HEX(a) FROM t1; SELECT a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=sjis; +let $coll='sjis_japanese_nopad_ci'; +let $coll_pad='sjis_japanese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='sjis_nopad_bin'; +let $coll_pad='sjis_bin'; +--source include/ctype_pad_all_engines.inc --echo # --echo # End of 10.2 tests diff --git a/mysql-test/t/ctype_swe7.test b/mysql-test/t/ctype_swe7.test index 7d1ef89b374..2e648a89406 100644 --- a/mysql-test/t/ctype_swe7.test +++ b/mysql-test/t/ctype_swe7.test @@ -17,3 +17,24 @@ let $ctype_unescape_combinations=selected; --echo # --echo # End of 10.0 tests --echo # + + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=swe7; +let $coll='swe7_swedish_nopad_ci'; +let $coll_pad='swe7_swedish_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='swe7_nopad_bin'; +let $coll_pad='swe7_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test index 4909acee31d..7bc248aec2b 100644 --- a/mysql-test/t/ctype_tis620.test +++ b/mysql-test/t/ctype_tis620.test @@ -192,3 +192,23 @@ select hex(weight_string(cast(0xE0A1 as char) as char(1))); --echo # --echo # End of 5.6 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=tis620; +let $coll='tis620_thai_nopad_ci'; +let $coll_pad='tis620_thai_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='tis620_nopad_bin'; +let $coll_pad='tis620_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 2f480621c56..aa5838e7c6d 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -957,3 +957,23 @@ SELECT CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED); --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=ucs2; +let $coll='ucs2_general_nopad_ci'; +let $coll_pad='ucs2_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='ucs2_nopad_bin'; +let $coll_pad='ucs2_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index db85585efd9..17aa3850219 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -1399,7 +1399,7 @@ SELECT HEX(a) FROM t1 ORDER BY a;DROP TABLE t1; --echo # ---echo # End of 10.2 tests +--echo # Start of 10.2 tests --echo # --echo # @@ -1411,5 +1411,17 @@ SELECT HEX(a) FROM t1; DROP TABLE t1; --echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=ujis; +let $coll='ujis_japanese_nopad_ci'; +let $coll_pad='ujis_japanese_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='ujis_nopad_bin'; +let $coll_pad='ujis_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index bb7eb8cd959..3946da73f9b 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -895,3 +895,23 @@ SELECT CAST(CONVERT('1IJ3' USING utf16) AS SIGNED); --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=utf16; +let $coll='utf16_general_nopad_ci'; +let $coll_pad='utf16_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='utf16_nopad_bin'; +let $coll_pad='utf16_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_utf16le.test b/mysql-test/t/ctype_utf16le.test index 42017f9a635..665443bb278 100644 --- a/mysql-test/t/ctype_utf16le.test +++ b/mysql-test/t/ctype_utf16le.test @@ -778,3 +778,23 @@ SELECT CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED); --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=utf16le; +let $coll='utf16le_general_nopad_ci'; +let $coll_pad='utf16le_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='utf16le_nopad_bin'; +let $coll_pad='utf16le_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 4bff8a867f1..2fe075f24ef 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -979,3 +979,23 @@ SELECT CAST(CONVERT('1IJ3' USING utf32) AS SIGNED); --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +SET character_set_connection=utf32; +let $coll='utf32_general_nopad_ci'; +let $coll_pad='utf32_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='utf32_nopad_bin'; +let $coll_pad='utf32_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index c4d94166493..352359a03b6 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -2059,6 +2059,18 @@ INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +let $coll='utf8_general_nopad_ci'; +let $coll_pad='utf8_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='utf8_nopad_bin'; +let $coll_pad='utf8_bin'; +--source include/ctype_pad_all_engines.inc + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 7c7c532b045..12fb5455e20 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -1954,5 +1954,16 @@ SELECT HEX(a) FROM t1; DROP TABLE t1; --echo # +--echo # MDEV-9711 NO PAD Collatons +--echo # +let $coll='utf8mb4_general_nopad_ci'; +let $coll_pad='utf8mb4_general_ci'; +--source include/ctype_pad_all_engines.inc + +let $coll='utf8mb4_nopad_bin'; +let $coll_pad='utf8mb4_bin'; +--source include/ctype_pad_all_engines.inc + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysys/charset-def.c b/mysys/charset-def.c index defb5c0062d..58fe16f353f 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -184,12 +184,16 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_filename); add_compiled_collation(&my_charset_latin1); + add_compiled_collation(&my_charset_latin1_nopad); add_compiled_collation(&my_charset_latin1_bin); + add_compiled_collation(&my_charset_latin1_nopad_bin); add_compiled_collation(&my_charset_latin1_german2_ci); #ifdef HAVE_CHARSET_big5 add_compiled_collation(&my_charset_big5_chinese_ci); add_compiled_collation(&my_charset_big5_bin); + add_compiled_collation(&my_charset_big5_chinese_nopad_ci); + add_compiled_collation(&my_charset_big5_nopad_bin); #endif #ifdef HAVE_CHARSET_cp1250 @@ -199,6 +203,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_cp932 add_compiled_collation(&my_charset_cp932_japanese_ci); add_compiled_collation(&my_charset_cp932_bin); + add_compiled_collation(&my_charset_cp932_japanese_nopad_ci); + add_compiled_collation(&my_charset_cp932_nopad_bin); #endif #ifdef HAVE_CHARSET_latin2 @@ -208,36 +214,50 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_eucjpms add_compiled_collation(&my_charset_eucjpms_japanese_ci); add_compiled_collation(&my_charset_eucjpms_bin); + add_compiled_collation(&my_charset_eucjpms_japanese_nopad_ci); + add_compiled_collation(&my_charset_eucjpms_nopad_bin); #endif #ifdef HAVE_CHARSET_euckr add_compiled_collation(&my_charset_euckr_korean_ci); add_compiled_collation(&my_charset_euckr_bin); + add_compiled_collation(&my_charset_euckr_korean_nopad_ci); + add_compiled_collation(&my_charset_euckr_nopad_bin); #endif #ifdef HAVE_CHARSET_gb2312 add_compiled_collation(&my_charset_gb2312_chinese_ci); add_compiled_collation(&my_charset_gb2312_bin); + add_compiled_collation(&my_charset_gb2312_chinese_nopad_ci); + add_compiled_collation(&my_charset_gb2312_nopad_bin); #endif #ifdef HAVE_CHARSET_gbk add_compiled_collation(&my_charset_gbk_chinese_ci); add_compiled_collation(&my_charset_gbk_bin); + add_compiled_collation(&my_charset_gbk_chinese_nopad_ci); + add_compiled_collation(&my_charset_gbk_nopad_bin); #endif #ifdef HAVE_CHARSET_sjis add_compiled_collation(&my_charset_sjis_japanese_ci); add_compiled_collation(&my_charset_sjis_bin); + add_compiled_collation(&my_charset_sjis_japanese_nopad_ci); + add_compiled_collation(&my_charset_sjis_nopad_bin); #endif #ifdef HAVE_CHARSET_tis620 add_compiled_collation(&my_charset_tis620_thai_ci); add_compiled_collation(&my_charset_tis620_bin); + add_compiled_collation(&my_charset_tis620_thai_nopad_ci); + add_compiled_collation(&my_charset_tis620_nopad_bin); #endif #ifdef HAVE_CHARSET_ucs2 add_compiled_collation(&my_charset_ucs2_general_ci); add_compiled_collation(&my_charset_ucs2_bin); + add_compiled_collation(&my_charset_ucs2_general_nopad_ci); + add_compiled_collation(&my_charset_ucs2_nopad_bin); add_compiled_collation(&my_charset_ucs2_general_mysql500_ci); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_ucs2_unicode_ci); @@ -273,11 +293,15 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_ujis add_compiled_collation(&my_charset_ujis_japanese_ci); add_compiled_collation(&my_charset_ujis_bin); + add_compiled_collation(&my_charset_ujis_japanese_nopad_ci); + add_compiled_collation(&my_charset_ujis_nopad_bin); #endif #ifdef HAVE_CHARSET_utf8 add_compiled_collation(&my_charset_utf8_general_ci); + add_compiled_collation(&my_charset_utf8_general_nopad_ci); add_compiled_collation(&my_charset_utf8_bin); + add_compiled_collation(&my_charset_utf8_nopad_bin); add_compiled_collation(&my_charset_utf8_general_mysql500_ci); #ifdef HAVE_UTF8_GENERAL_CS add_compiled_collation(&my_charset_utf8_general_cs); @@ -317,6 +341,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_utf8mb4 add_compiled_collation(&my_charset_utf8mb4_general_ci); add_compiled_collation(&my_charset_utf8mb4_bin); + add_compiled_collation(&my_charset_utf8mb4_general_nopad_ci); + add_compiled_collation(&my_charset_utf8mb4_nopad_bin); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf8mb4_unicode_ci); add_compiled_collation(&my_charset_utf8mb4_german2_uca_ci); @@ -354,6 +380,10 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf16_bin); add_compiled_collation(&my_charset_utf16le_general_ci); add_compiled_collation(&my_charset_utf16le_bin); + add_compiled_collation(&my_charset_utf16_general_nopad_ci); + add_compiled_collation(&my_charset_utf16_nopad_bin); + add_compiled_collation(&my_charset_utf16le_general_nopad_ci); + add_compiled_collation(&my_charset_utf16le_nopad_bin); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf16_unicode_ci); add_compiled_collation(&my_charset_utf16_german2_uca_ci); @@ -389,6 +419,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_utf32 add_compiled_collation(&my_charset_utf32_general_ci); add_compiled_collation(&my_charset_utf32_bin); + add_compiled_collation(&my_charset_utf32_general_nopad_ci); + add_compiled_collation(&my_charset_utf32_nopad_bin); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf32_unicode_ci); add_compiled_collation(&my_charset_utf32_german2_uca_ci); diff --git a/mysys/charset.c b/mysys/charset.c index 2efe415af54..2d9df9f47e4 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -123,13 +123,21 @@ static my_bool init_state_maps(struct charset_info_st *cs) } +static MY_COLLATION_HANDLER *get_simple_collation_handler_by_flags(uint flags) +{ + return flags & MY_CS_BINSORT ? + (flags & MY_CS_NOPAD ? + &my_collation_8bit_nopad_bin_handler : + &my_collation_8bit_bin_handler) : + (flags & MY_CS_NOPAD ? + &my_collation_8bit_simple_nopad_ci_handler : + &my_collation_8bit_simple_ci_handler); +} + + static void simple_cs_init_functions(struct charset_info_st *cs) { - if (cs->state & MY_CS_BINSORT) - cs->coll= &my_collation_8bit_bin_handler; - else - cs->coll= &my_collation_8bit_simple_ci_handler; - + cs->coll= get_simple_collation_handler_by_flags(cs->state); cs->cset= &my_charset_8bit_handler; } diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 9764d629625..912d196cc3c 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -67,6 +67,12 @@ To make maintaining easier please: <collation name="latin2_hungarian_ci" id="21" order="Hungarian"/> <collation name="latin2_croatian_ci" id="27" order="Croatian"/> <collation name="latin2_bin" id="77" order="Binary" flag="binary"/> + <collation name="latin2_general_nopad_ci" id="1033" flag="nopad"> + <rules> + <import source="latin2_general_ci"/> + </rules> + </collation> + <collation name="latin2_nopad_bin" id="1101" flag="binary" flag="nopad"/> </charset> <charset name="dec8"> @@ -83,6 +89,12 @@ To make maintaining easier please: <order>Portuguese</order> <order>Spanish</order> </collation> + <collation name="dec8_swedish_nopad_ci" id="1027" flag="nopad"> + <rules> + <import source="dec8_swedish_ci"/> + </rules> + </collation> + <collation name="dec8_nopad_bin" id="1093" flag="binary" flag="nopad"/> </charset> <charset name="cp850"> @@ -102,6 +114,12 @@ To make maintaining easier please: <order>Spanish</order> </collation> <collation name="cp850_bin" id="80" order="Binary" flag="binary"/> + <collation name="cp850_general_nopad_ci" id="1028" flag="nopad"> + <rules> + <import source="cp850_general_ci"/> + </rules> + </collation> + <collation name="cp850_nopad_bin" id="1104" flag="binary" flag="nopad"/> </charset> <charset name="latin1"> @@ -163,6 +181,12 @@ To make maintaining easier please: <order>Portuguese</order> <order>Spanish</order> </collation> + <collation name="hp8_english_nopad_ci" id="1030" flag="nopad"> + <rules> + <import source="hp8_english_ci"/> + </rules> + </collation> + <collation name="hp8_nopad_bin" id="1096" flag="binary" flag="nopad"/> </charset> <charset name="koi8r"> @@ -172,6 +196,12 @@ To make maintaining easier please: <alias>cskoi8r</alias> <collation name="koi8r_general_ci" id="7" order="Russian" flag="primary"/> <collation name="koi8r_bin" id="74" order="Binary" flag="binary"/> + <collation name="koi8r_general_nopad_ci" id="1031" flag="nopad"> + <rules> + <import source="koi8r_general_ci"/> + </rules> + </collation> + <collation name="koi8r_nopad_bin" id="1098" flag="binary" flag="nopad"/> </charset> <charset name="swe7"> @@ -180,6 +210,12 @@ To make maintaining easier please: <alias>iso-646-se</alias> <collation name="swe7_swedish_ci" id="10" order="Swedish" flag="primary"/> <collation name="swe7_bin" id="82" order="Binary" flag="binary"/> + <collation name="swe7_swedish_nopad_ci" id="1034" flag="nopad"> + <rules> + <import source="swe7_swedish_ci"/> + </rules> + </collation> + <collation name="swe7_nopad_bin" id="1106" flag="binary" flag="nopad"/> </charset> <charset name="ascii"> @@ -192,6 +228,12 @@ To make maintaining easier please: <alias>iso646-us</alias> <collation name="ascii_general_ci" id="11" order="English" flag="primary"/> <collation name="ascii_bin" id="65" order="Binary" flag="binary"/> + <collation name="ascii_general_nopad_ci" id="1035" flag="nopad"> + <rules> + <import source="ascii_general_ci"/> + </rules> + </collation> + <collation name="ascii_nopad_bin" id="1089" flag="binary" flag="nopad"/> </charset> <charset name="ujis"> @@ -259,6 +301,12 @@ To make maintaining easier please: <order>Mongolian</order> <order>Ukrainian</order> </collation> + <collation name="cp1251_general_nopad_ci" id="1075" flag="nopad"> + <rules> + <import source="cp1251_general_ci"/> + </rules> + </collation> + <collation name="cp1251_nopad_bin" id="1074" flag="binary" flag="nopad"/> </charset> <charset name="hebrew"> @@ -269,6 +317,12 @@ To make maintaining easier please: <alias>iso-ir-138</alias> <collation name="hebrew_general_ci" id="16" order="Hebrew" flag="primary"/> <collation name="hebrew_bin" id="71" order="Binary" flag="binary"/> + <collation name="hebrew_general_nopad_ci" id="1040" flag="nopad"> + <rules> + <import source="hebrew_general_ci"/> + </rules> + </collation> + <collation name="hebrew_nopad_bin" id="1095" flag="binary" flag="nopad"/> </charset> <charset name="tis620"> @@ -319,6 +373,12 @@ To make maintaining easier please: <order>Lithuanian</order> </collation> <collation name="latin7_bin" id="79" order="Binary" flag="binary"/> + <collation name="latin7_general_nopad_ci" id="1065" flag="nopad"> + <rules> + <import source="latin7_general_ci"/> + </rules> + </collation> + <collation name="latin7_nopad_bin" id="1103" flag="binary" flag="nopad"/> </charset> <charset name="koi8u"> @@ -327,6 +387,12 @@ To make maintaining easier please: <alias>koi8-u</alias> <collation name="koi8u_general_ci" id="22" order="Ukranian" flag="primary"/> <collation name="koi8u_bin" id="75" order="Binary" flag="binary"/> + <collation name="koi8u_general_nopad_ci" id="1046" flag="nopad"> + <rules> + <import source="koi8u_general_ci"/> + </rules> + </collation> + <collation name="koi8u_nopad_bin" id="1099" flag="binary" flag="nopad"/> </charset> <charset name="gb2312"> @@ -354,6 +420,12 @@ To make maintaining easier please: <alias>iso-ir-126</alias> <collation name="greek_general_ci" id="25" order="Greek" flag="primary"/> <collation name="greek_bin" id="70" order="Binary" flag="binary"/> + <collation name="greek_general_nopad_ci" id="1049" flag="nopad"> + <rules> + <import source="greek_general_ci"/> + </rules> + </collation> + <collation name="greek_nopad_bin" id="1094" flag="binary" flag="nopad"/> </charset> <charset name="cp1250"> @@ -380,6 +452,12 @@ To make maintaining easier please: <flag>compiled</flag> </collation> <collation name="cp1250_bin" id="66" order="Binary" flag="binary"/> + <collation name="cp1250_general_nopad_ci" id="1050" flag="nopad"> + <rules> + <import source="cp1250_general_ci"/> + </rules> + </collation> + <collation name="cp1250_nopad_bin" id="1090" flag="binary" flag="nopad"/> </charset> <charset name="gbk"> @@ -407,6 +485,12 @@ To make maintaining easier please: <order>Latvian</order> <order>Lithuanian</order> </collation> + <collation name="cp1257_general_nopad_ci" id="1083" flag="nopad"> + <rules> + <import source="cp1257_general_ci"/> + </rules> + </collation> + <collation name="cp1257_nopad_bin" id="1082" flag="binary" flag="nopad"/> <!--collation name="cp1257_ci" id="60"/--> <!--collation name="cp1257_cs" id="61"/--> </charset> @@ -422,6 +506,12 @@ To make maintaining easier please: <alias>turkish</alias> <collation name="latin5_turkish_ci" id="30" order="Turkish" flag="primary"/> <collation name="latin5_bin" id="78" order="Binary" flag="binary"/> + <collation name="latin5_turkish_nopad_ci" id="1054" flag="nopad"> + <rules> + <import source="latin5_turkish_ci"/> + </rules> + </collation> + <collation name="latin5_nopad_bin" id="1102" flag="binary" flag="nopad"/> </charset> <charset name="armscii8"> @@ -430,6 +520,12 @@ To make maintaining easier please: <alias>armscii-8</alias> <collation name="armscii8_general_ci" id="32" order="Armenian" flag="primary"/> <collation name="armscii8_bin" id="64" order="Binary" flag="binary"/> + <collation name="armscii8_general_nopad_ci" id="1056" flag="nopad"> + <rules> + <import source="armscii8_general_ci"/> + </rules> + </collation> + <collation name="armscii8_nopad_bin" id="1088" flag="binary" flag="nopad"/> </charset> <charset name="utf8"> @@ -468,6 +564,12 @@ To make maintaining easier please: <alias>DOSCyrillicRussian</alias> <collation name="cp866_general_ci" id="36" order="Russian" flag="primary"/> <collation name="cp866_bin" id="68" order="Binary" flag="binary"/> + <collation name="cp866_general_nopad_ci" id="1060" flag="nopad"> + <rules> + <import source="cp866_general_ci"/> + </rules> + </collation> + <collation name="cp866_nopad_bin" id="1092" flag="binary" flag="nopad"/> </charset> <charset name="keybcs2"> @@ -475,6 +577,12 @@ To make maintaining easier please: <description>DOS Kamenicky Czech-Slovak</description> <collation name="keybcs2_general_ci" id="37" order="Czech" flag="primary"/> <collation name="keybcs2_bin" id="73" order="Binary" flag="binary"/> + <collation name="keybcs2_general_nopad_ci" id="1061" flag="nopad"> + <rules> + <import source="keybcs2_general_ci"/> + </rules> + </collation> + <collation name="keybcs2_nopad_bin" id="1097" flag="binary" flag="nopad"/> </charset> <charset name="macce"> @@ -491,6 +599,12 @@ To make maintaining easier please: <order>Sorbian</order> </collation> <collation name="macce_bin" id="43" order="Binary" flag="binary"/> + <collation name="macce_general_nopad_ci" id="1062" flag="nopad"> + <rules> + <import source="macce_general_ci"/> + </rules> + </collation> + <collation name="macce_nopad_bin" id="1067" flag="binary" flag="nopad"/> </charset> <charset name="macroman"> @@ -513,6 +627,12 @@ To make maintaining easier please: <!--collation name="macroman_ci" id="54"/--> <!--collation name="macroman_ci_ai" id="55"/--> <!--collation name="macroman_cs" id="56"/--> + <collation name="macroman_general_nopad_ci" id="1063" flag="nopad"> + <rules> + <import source="macroman_general_ci"/> + </rules> + </collation> + <collation name="macroman_nopad_bin" id="1077" flag="binary" flag="nopad"/> </charset> <charset name="cp852"> @@ -531,6 +651,12 @@ To make maintaining easier please: <order>Sorbian</order> </collation> <collation name="cp852_bin" id="81" order="Binary" flag="binary"/> + <collation name="cp852_general_nopad_ci" id="1064" flag="nopad"> + <rules> + <import source="cp852_general_ci"/> + </rules> + </collation> + <collation name="cp852_nopad_bin" id="1105" flag="binary" flag="nopad"/> </charset> <charset name="cp1256"> @@ -545,6 +671,12 @@ To make maintaining easier please: <order>Pakistani</order> <order>Urdu</order> </collation> + <collation name="cp1256_general_nopad_ci" id="1081" flag="nopad"> + <rules> + <import source="cp1256_general_ci"/> + </rules> + </collation> + <collation name="cp1256_nopad_bin" id="1091" flag="binary" flag="nopad"/> </charset> <charset name="geostd8"> @@ -552,6 +684,12 @@ To make maintaining easier please: <description>GEOSTD8 Georgian</description> <collation name="geostd8_general_ci" id="92" order="Georgian" flag="primary"/> <collation name="geostd8_bin" id="93" order="Binary" flag="binary"/> + <collation name="geostd8_general_nopad_ci" id="1116" flag="nopad"> + <rules> + <import source="geostd8_general_ci"/> + </rules> + </collation> + <collation name="geostd8_nopad_bin" id="1117" flag="binary" flag="nopad"/> </charset> <charset name="binary"> @@ -596,4 +734,3 @@ To make maintaining easier please: </charset> </charsets> - diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c index 1382ec69a0a..c7f25331534 100644 --- a/strings/conf_to_src.c +++ b/strings/conf_to_src.c @@ -338,16 +338,23 @@ print_array_ref(FILE *f, } +static const char *nopad_infix(CHARSET_INFO *cs) +{ + return (cs->state & MY_CS_NOPAD) ? "_nopad" : ""; +} + + void dispcset(FILE *f,CHARSET_INFO *cs) { fprintf(f,"{\n"); fprintf(f," %d,%d,%d,\n",cs->number,0,0); - fprintf(f," MY_CS_COMPILED%s%s%s%s%s,\n", + fprintf(f," MY_CS_COMPILED%s%s%s%s%s%s,\n", cs->state & MY_CS_BINSORT ? "|MY_CS_BINSORT" : "", cs->state & MY_CS_PRIMARY ? "|MY_CS_PRIMARY" : "", cs->state & MY_CS_CSSORT ? "|MY_CS_CSSORT" : "", cs->state & MY_CS_PUREASCII ? "|MY_CS_PUREASCII" : "", - cs->state & MY_CS_NONASCII ? "|MY_CS_NONASCII" : ""); + cs->state & MY_CS_NONASCII ? "|MY_CS_NONASCII" : "", + cs->state & MY_CS_NOPAD ? "|MY_CS_NOPAD" : ""); if (cs->name) { @@ -402,10 +409,11 @@ void dispcset(FILE *f,CHARSET_INFO *cs) fprintf(f," 0, /* escape_with_backslash_is_dangerous */\n"); fprintf(f," 1, /* levels_for_order */\n"); fprintf(f," &my_charset_8bit_handler,\n"); + if (cs->state & MY_CS_BINSORT) - fprintf(f," &my_collation_8bit_bin_handler,\n"); + fprintf(f," &my_collation_8bit%s_bin_handler,\n", nopad_infix(cs)); else - fprintf(f," &my_collation_8bit_simple_ci_handler,\n"); + fprintf(f," &my_collation_8bit_simple%s_ci_handler,\n", nopad_infix(cs)); fprintf(f,"}\n"); } diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 9ae394eeedc..dd66da224ba 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6690,6 +6690,22 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_chinese_nopad_ci +#define WEIGHT_MB1(x) (sort_order_big5[(uchar) (x)]) +#define WEIGHT_MB2(x,y) (big5code(x, y)) +#define WEIGHT_MB2_FRM(x,y) (big5strokexfrm((uint16) WEIGHT_MB2(x, y))) +#define DEFINE_STRNXFRM +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_nopad_bin +#define WEIGHT_MB1(x) ((uchar) (x)) +#define WEIGHT_MB2(x,y) (big5code(x, y)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_handler_big5_chinese_ci= { NULL, /* init */ @@ -6722,6 +6738,38 @@ static MY_COLLATION_HANDLER my_collation_handler_big5_bin= }; +static MY_COLLATION_HANDLER my_collation_handler_big5_chinese_nopad_ci= +{ + NULL, /* init */ + my_strnncoll_big5_chinese_ci, + my_strnncollsp_big5_chinese_nopad_ci, + my_strnxfrm_big5_chinese_nopad_ci, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_handler_big5_nopad_bin= +{ + NULL, /* init */ + my_strnncoll_big5_bin, + my_strnncollsp_big5_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_big5_handler= { NULL, /* init */ @@ -6821,4 +6869,70 @@ struct charset_info_st my_charset_big5_bin= }; +struct charset_info_st my_charset_big5_chinese_nopad_ci= +{ + MY_NOPAD_ID(1),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NOPAD, /* state */ + "big5", /* cs name */ + "big5_chinese_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_big5, + to_lower_big5, + to_upper_big5, + sort_order_big5, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_big5, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xF9D5, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_big5_handler, + &my_collation_handler_big5_chinese_nopad_ci +}; + + +struct charset_info_st my_charset_big5_nopad_bin= +{ + MY_NOPAD_ID(84),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "big5", /* cs name */ + "big5_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_big5, + to_lower_big5, + to_upper_big5, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_big5, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xF9FE, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_big5_handler, + &my_collation_handler_big5_nopad_bin +}; + + #endif diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index aab7f2b7448..5655edd6063 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -199,6 +199,15 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), } +static int my_strnncollsp_8bit_nopad_bin(CHARSET_INFO * cs + __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length) +{ + return my_strnncoll_8bit_bin(cs, a, a_length, b, b_length, FALSE); +} + + /* This function is used for all conversion functions */ static size_t my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)), @@ -253,19 +262,13 @@ int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), } -void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, size_t len, - ulong *nr1, ulong *nr2) +void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { + const uchar *end = key + len; ulong tmp1= *nr1; ulong tmp2= *nr2; - /* - Remove trailing spaces. We have to do this to be able to compare - 'A ' and 'A' as identical - */ - const uchar *end = skip_trailing_space(key, len); - for (; key < end ; key++) { MY_HASH_ADD(tmp1, tmp2, (uint) *key); @@ -276,20 +279,16 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), } -void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, size_t len,ulong *nr1, ulong *nr2) +void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) { - const uchar *end = key + len; - ulong tmp1= *nr1; - ulong tmp2= *nr2; - - for (; key < end ; key++) - { - MY_HASH_ADD(tmp1, tmp2, (uint) *key); - } - - *nr1= tmp1; - *nr2= tmp2; + /* + Remove trailing spaces. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + const uchar *end= skip_trailing_space(key, len); + my_hash_sort_bin(cs, key, end - key, nr1, nr2); } @@ -407,6 +406,21 @@ my_strnxfrm_8bit_bin(CHARSET_INFO *cs, } +static size_t +my_strnxfrm_8bit_nopad_bin(CHARSET_INFO *cs, + uchar * dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + set_if_smaller(srclen, dstlen); + set_if_smaller(srclen, nweights); + if (dst != src) + memcpy(dst, src, srclen); + return my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + srclen, + dst + dstlen, nweights - srclen, + flags, 0); +} + + static uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), const char *b, size_t b_length, @@ -484,6 +498,22 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler = }; +MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler = +{ + my_coll_init_8bit_bin, + my_strnncoll_8bit_bin, + my_strnncollsp_8bit_nopad_bin, + my_strnxfrm_8bit_nopad_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_bin, + my_propagate_simple +}; + + static MY_COLLATION_HANDLER my_collation_binary_handler = { NULL, /* init */ diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 151fac8a052..83f8d40c480 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -34646,6 +34646,22 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _cp932_japanese_nopad_ci +#define WEIGHT_PAD_SPACE (256 * (int) ' ') +#define WEIGHT_MB1(x) (256 * (int) sort_order_cp932[(uchar) (x)]) +#define WEIGHT_MB2(x,y) (cp932code(x, y)) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _cp932_nopad_bin +#define WEIGHT_PAD_SPACE (256 * (int) ' ') +#define WEIGHT_MB1(x) (256 * (int) (uchar) (x)) +#define WEIGHT_MB2(x,y) (cp932code(x, y)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_handler_cp932_japanese_ci= { NULL, /* init */ @@ -34678,6 +34694,38 @@ static MY_COLLATION_HANDLER my_collation_handler_cp932_bin= }; +static MY_COLLATION_HANDLER my_collation_handler_cp932_japanese_nopad_ci= +{ + NULL, /* init */ + my_strnncoll_cp932_japanese_ci, + my_strnncollsp_cp932_japanese_nopad_ci, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_8bit, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_handler_cp932_nopad_bin= +{ + NULL, /* init */ + my_strnncoll_cp932_bin, + my_strnncollsp_cp932_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -34776,4 +34824,69 @@ struct charset_info_st my_charset_cp932_bin= &my_collation_handler_cp932_bin }; + +struct charset_info_st my_charset_cp932_japanese_nopad_ci= +{ + MY_NOPAD_ID(95),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NOPAD, /* state */ + "cp932", /* cs name */ + "cp932_japanese_nopad_ci",/* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp932, + to_lower_cp932, + to_upper_cp932, + sort_order_cp932, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_cp932, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFCFC, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_cp932_japanese_nopad_ci +}; + +struct charset_info_st my_charset_cp932_nopad_bin= +{ + MY_NOPAD_ID(96),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "cp932", /* cs name */ + "cp932_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp932, + to_lower_cp932, + to_upper_cp932, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_cp932, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFCFC, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_cp932_nopad_bin +}; + #endif diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index d2389136c49..e2a50da2ed4 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -9938,6 +9938,20 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_korean_nopad_ci +#define WEIGHT_MB1(x) (sort_order_euc_kr[(uchar) (x)]) +#define WEIGHT_MB2(x,y) (euckrcode(x, y)) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_nopad_bin +#define WEIGHT_MB1(x) ((uchar) (x)) +#define WEIGHT_MB2(x,y) (euckrcode(x, y)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_handler_euckr_korean_ci= { NULL, /* init */ @@ -9970,6 +9984,38 @@ static MY_COLLATION_HANDLER my_collation_handler_euckr_bin= }; +static MY_COLLATION_HANDLER my_collation_handler_euckr_korean_nopad_ci= +{ + NULL, /* init */ + my_strnncoll_euckr_korean_ci, + my_strnncollsp_euckr_korean_nopad_ci, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_handler_euckr_nopad_bin= +{ + NULL, /* init */ + my_strnncoll_euckr_bin, + my_strnncollsp_euckr_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -10069,4 +10115,70 @@ struct charset_info_st my_charset_euckr_bin= &my_collation_handler_euckr_bin }; + +struct charset_info_st my_charset_euckr_korean_nopad_ci= +{ + MY_NOPAD_ID(19),0,0,/* number */ + MY_CS_COMPILED|MY_CS_NOPAD, /* state */ + "euckr", /* cs name */ + "euckr_korean_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_euc_kr, + to_lower_euc_kr, + to_upper_euc_kr, + sort_order_euc_kr, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_euckr, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_euckr_korean_nopad_ci +}; + + +struct charset_info_st my_charset_euckr_nopad_bin= +{ + MY_NOPAD_ID(85),0,0,/* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "euckr", /* cs name */ + "euckr_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_euc_kr, + to_lower_euc_kr, + to_upper_euc_kr, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_euckr, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_euckr_nopad_bin +}; + #endif diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index caafd1d13b4..47d03bd5d99 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -221,6 +221,26 @@ static const uchar sort_order_eucjpms[]= #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms_japanese_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) sort_order_eucjpms[(uchar) (x)]) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) (uchar) (x)) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + + /* Case info pages for JIS-X-0208 range */ static MY_UNICASE_CHARACTER cA2[256]= @@ -67502,6 +67522,38 @@ static MY_COLLATION_HANDLER my_collation_eucjpms_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_eucjpms_japanese_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_eucjpms_japanese_ci, + my_strnncollsp_eucjpms_japanese_nopad_ci, + my_strnxfrm_mb_nopad, /* strnxfrm */ + my_strnxfrmlen_simple, + my_like_range_mb, /* like_range */ + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_eucjpms_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_eucjpms_bin, + my_strnncollsp_eucjpms_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -67603,4 +67655,70 @@ struct charset_info_st my_charset_eucjpms_bin= }; +struct charset_info_st my_charset_eucjpms_japanese_nopad_ci= +{ + MY_NOPAD_ID(97),0,0, /* number */ + MY_CS_COMPILED|MY_CS_NOPAD,/* state */ + "eucjpms", /* cs name */ + "eucjpms_japanese_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_eucjpms, + to_lower_eucjpms, + to_upper_eucjpms, + sort_order_eucjpms, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_eucjpms,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 2, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_eucjpms_japanese_nopad_ci_handler +}; + + +struct charset_info_st my_charset_eucjpms_nopad_bin= +{ + MY_NOPAD_ID(98),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "eucjpms", /* cs name */ + "eucjpms_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_eucjpms, + to_lower_eucjpms, + to_upper_eucjpms, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_eucjpms,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 2, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_eucjpms_nopad_bin_handler +}; + + #endif diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c index caf8ebaf0a7..a2eb2b80e49 100644 --- a/strings/ctype-extra.c +++ b/strings/ctype-extra.c @@ -3535,6 +3535,144 @@ static const uchar sort_order_cp1250_polish_ci[] = { #endif +#ifdef HAVE_CHARSET_dec8 +#endif + +#ifdef HAVE_CHARSET_cp850 +#endif + +#ifdef HAVE_CHARSET_hp8 +#endif + +#ifdef HAVE_CHARSET_koi8r +#endif + +#ifdef HAVE_CHARSET_latin2 +#endif + +#ifdef HAVE_CHARSET_swe7 +#endif + +#ifdef HAVE_CHARSET_ascii +#endif + +#ifdef HAVE_CHARSET_hebrew +#endif + +#ifdef HAVE_CHARSET_koi8u +#endif + +#ifdef HAVE_CHARSET_greek +#endif + +#ifdef HAVE_CHARSET_cp1250 +#endif + +#ifdef HAVE_CHARSET_latin5 +#endif + +#ifdef HAVE_CHARSET_armscii8 +#endif + +#ifdef HAVE_CHARSET_cp866 +#endif + +#ifdef HAVE_CHARSET_keybcs2 +#endif + +#ifdef HAVE_CHARSET_macce +#endif + +#ifdef HAVE_CHARSET_macroman +#endif + +#ifdef HAVE_CHARSET_cp852 +#endif + +#ifdef HAVE_CHARSET_latin7 +#endif + +#ifdef HAVE_CHARSET_macce +#endif + +#ifdef HAVE_CHARSET_cp1251 +#endif + +#ifdef HAVE_CHARSET_cp1251 +#endif + +#ifdef HAVE_CHARSET_macroman +#endif + +#ifdef HAVE_CHARSET_cp1256 +#endif + +#ifdef HAVE_CHARSET_cp1257 +#endif + +#ifdef HAVE_CHARSET_cp1257 +#endif + +#ifdef HAVE_CHARSET_armscii8 +#endif + +#ifdef HAVE_CHARSET_ascii +#endif + +#ifdef HAVE_CHARSET_cp1250 +#endif + +#ifdef HAVE_CHARSET_cp1256 +#endif + +#ifdef HAVE_CHARSET_cp866 +#endif + +#ifdef HAVE_CHARSET_dec8 +#endif + +#ifdef HAVE_CHARSET_greek +#endif + +#ifdef HAVE_CHARSET_hebrew +#endif + +#ifdef HAVE_CHARSET_hp8 +#endif + +#ifdef HAVE_CHARSET_keybcs2 +#endif + +#ifdef HAVE_CHARSET_koi8r +#endif + +#ifdef HAVE_CHARSET_koi8u +#endif + +#ifdef HAVE_CHARSET_latin2 +#endif + +#ifdef HAVE_CHARSET_latin5 +#endif + +#ifdef HAVE_CHARSET_latin7 +#endif + +#ifdef HAVE_CHARSET_cp850 +#endif + +#ifdef HAVE_CHARSET_cp852 +#endif + +#ifdef HAVE_CHARSET_swe7 +#endif + +#ifdef HAVE_CHARSET_geostd8 +#endif + +#ifdef HAVE_CHARSET_geostd8 +#endif + struct charset_info_st compiled_charsets[] = { #ifdef HAVE_CHARSET_dec8 { @@ -3545,11 +3683,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_dec8_swedish_ci, /* ctype */ - to_lower_dec8_swedish_ci, /* lower */ - to_upper_dec8_swedish_ci, /* upper */ + to_lower_dec8_swedish_ci, /* to_lower */ + to_upper_dec8_swedish_ci, /* to_upper */ sort_order_dec8_swedish_ci, /* sort_order */ NULL, /* uca */ - to_uni_dec8_swedish_ci, /* to_uni */ + to_uni_dec8_swedish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3578,11 +3716,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp850_general_ci, /* ctype */ - to_lower_cp850_general_ci, /* lower */ - to_upper_cp850_general_ci, /* upper */ + to_lower_cp850_general_ci, /* to_lower */ + to_upper_cp850_general_ci, /* to_upper */ sort_order_cp850_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp850_general_ci, /* to_uni */ + to_uni_cp850_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3611,11 +3749,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin1_german1_ci, /* ctype */ - to_lower_latin1_german1_ci, /* lower */ - to_upper_latin1_german1_ci, /* upper */ + to_lower_latin1_german1_ci, /* to_lower */ + to_upper_latin1_german1_ci, /* to_upper */ sort_order_latin1_german1_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin1_german1_ci, /* to_uni */ + to_uni_latin1_german1_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3644,11 +3782,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_hp8_english_ci, /* ctype */ - to_lower_hp8_english_ci, /* lower */ - to_upper_hp8_english_ci, /* upper */ + to_lower_hp8_english_ci, /* to_lower */ + to_upper_hp8_english_ci, /* to_upper */ sort_order_hp8_english_ci, /* sort_order */ NULL, /* uca */ - to_uni_hp8_english_ci, /* to_uni */ + to_uni_hp8_english_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3677,11 +3815,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_koi8r_general_ci, /* ctype */ - to_lower_koi8r_general_ci, /* lower */ - to_upper_koi8r_general_ci, /* upper */ + to_lower_koi8r_general_ci, /* to_lower */ + to_upper_koi8r_general_ci, /* to_upper */ sort_order_koi8r_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_koi8r_general_ci, /* to_uni */ + to_uni_koi8r_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3710,11 +3848,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin2_general_ci, /* ctype */ - to_lower_latin2_general_ci, /* lower */ - to_upper_latin2_general_ci, /* upper */ + to_lower_latin2_general_ci, /* to_lower */ + to_upper_latin2_general_ci, /* to_upper */ sort_order_latin2_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin2_general_ci, /* to_uni */ + to_uni_latin2_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3743,11 +3881,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_swe7_swedish_ci, /* ctype */ - to_lower_swe7_swedish_ci, /* lower */ - to_upper_swe7_swedish_ci, /* upper */ + to_lower_swe7_swedish_ci, /* to_lower */ + to_upper_swe7_swedish_ci, /* to_upper */ sort_order_swe7_swedish_ci, /* sort_order */ NULL, /* uca */ - to_uni_swe7_swedish_ci, /* to_uni */ + to_uni_swe7_swedish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3776,11 +3914,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_ascii_general_ci, /* ctype */ - to_lower_ascii_general_ci, /* lower */ - to_upper_ascii_general_ci, /* upper */ + to_lower_ascii_general_ci, /* to_lower */ + to_upper_ascii_general_ci, /* to_upper */ sort_order_ascii_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_ascii_general_ci, /* to_uni */ + to_uni_ascii_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3809,11 +3947,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1251_general_ci, /* ctype */ - to_lower_cp1251_general_ci, /* lower */ - to_upper_cp1251_general_ci, /* upper */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ sort_order_cp1251_bulgarian_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1251_general_ci, /* to_uni */ + to_uni_cp1251_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3842,11 +3980,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin1_danish_ci, /* ctype */ - to_lower_latin1_danish_ci, /* lower */ - to_upper_latin1_danish_ci, /* upper */ + to_lower_latin1_danish_ci, /* to_lower */ + to_upper_latin1_danish_ci, /* to_upper */ sort_order_latin1_danish_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin1_danish_ci, /* to_uni */ + to_uni_latin1_danish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3875,11 +4013,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_hebrew_general_ci, /* ctype */ - to_lower_hebrew_general_ci, /* lower */ - to_upper_hebrew_general_ci, /* upper */ + to_lower_hebrew_general_ci, /* to_lower */ + to_upper_hebrew_general_ci, /* to_upper */ sort_order_hebrew_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_hebrew_general_ci, /* to_uni */ + to_uni_hebrew_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3908,11 +4046,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin7_general_ci, /* ctype */ - to_lower_latin7_general_ci, /* lower */ - to_upper_latin7_general_ci, /* upper */ + to_lower_latin7_general_ci, /* to_lower */ + to_upper_latin7_general_ci, /* to_upper */ sort_order_latin7_estonian_cs, /* sort_order */ NULL, /* uca */ - to_uni_latin7_general_ci, /* to_uni */ + to_uni_latin7_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3941,11 +4079,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin2_general_ci, /* ctype */ - to_lower_latin2_general_ci, /* lower */ - to_upper_latin2_general_ci, /* upper */ + to_lower_latin2_general_ci, /* to_lower */ + to_upper_latin2_general_ci, /* to_upper */ sort_order_latin2_hungarian_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin2_general_ci, /* to_uni */ + to_uni_latin2_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -3974,11 +4112,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_koi8u_general_ci, /* ctype */ - to_lower_koi8u_general_ci, /* lower */ - to_upper_koi8u_general_ci, /* upper */ + to_lower_koi8u_general_ci, /* to_lower */ + to_upper_koi8u_general_ci, /* to_upper */ sort_order_koi8u_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_koi8u_general_ci, /* to_uni */ + to_uni_koi8u_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4007,11 +4145,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1251_general_ci, /* ctype */ - to_lower_cp1251_general_ci, /* lower */ - to_upper_cp1251_general_ci, /* upper */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ sort_order_cp1251_ukrainian_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1251_general_ci, /* to_uni */ + to_uni_cp1251_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4040,11 +4178,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_greek_general_ci, /* ctype */ - to_lower_greek_general_ci, /* lower */ - to_upper_greek_general_ci, /* upper */ + to_lower_greek_general_ci, /* to_lower */ + to_upper_greek_general_ci, /* to_upper */ sort_order_greek_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_greek_general_ci, /* to_uni */ + to_uni_greek_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4073,11 +4211,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1250_general_ci, /* ctype */ - to_lower_cp1250_general_ci, /* lower */ - to_upper_cp1250_general_ci, /* upper */ + to_lower_cp1250_general_ci, /* to_lower */ + to_upper_cp1250_general_ci, /* to_upper */ sort_order_cp1250_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1250_general_ci, /* to_uni */ + to_uni_cp1250_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4106,11 +4244,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin2_general_ci, /* ctype */ - to_lower_latin2_general_ci, /* lower */ - to_upper_latin2_general_ci, /* upper */ + to_lower_latin2_general_ci, /* to_lower */ + to_upper_latin2_general_ci, /* to_upper */ sort_order_latin2_croatian_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin2_general_ci, /* to_uni */ + to_uni_latin2_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4139,11 +4277,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1257_general_ci, /* ctype */ - to_lower_cp1257_general_ci, /* lower */ - to_upper_cp1257_general_ci, /* upper */ + to_lower_cp1257_general_ci, /* to_lower */ + to_upper_cp1257_general_ci, /* to_upper */ sort_order_cp1257_lithuanian_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1257_general_ci, /* to_uni */ + to_uni_cp1257_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4172,11 +4310,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin5_turkish_ci, /* ctype */ - to_lower_latin5_turkish_ci, /* lower */ - to_upper_latin5_turkish_ci, /* upper */ + to_lower_latin5_turkish_ci, /* to_lower */ + to_upper_latin5_turkish_ci, /* to_upper */ sort_order_latin5_turkish_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin5_turkish_ci, /* to_uni */ + to_uni_latin5_turkish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4205,11 +4343,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_armscii8_general_ci, /* ctype */ - to_lower_armscii8_general_ci, /* lower */ - to_upper_armscii8_general_ci, /* upper */ + to_lower_armscii8_general_ci, /* to_lower */ + to_upper_armscii8_general_ci, /* to_upper */ sort_order_armscii8_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_armscii8_general_ci, /* to_uni */ + to_uni_armscii8_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4238,11 +4376,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp866_general_ci, /* ctype */ - to_lower_cp866_general_ci, /* lower */ - to_upper_cp866_general_ci, /* upper */ + to_lower_cp866_general_ci, /* to_lower */ + to_upper_cp866_general_ci, /* to_upper */ sort_order_cp866_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp866_general_ci, /* to_uni */ + to_uni_cp866_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4271,11 +4409,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_keybcs2_general_ci, /* ctype */ - to_lower_keybcs2_general_ci, /* lower */ - to_upper_keybcs2_general_ci, /* upper */ + to_lower_keybcs2_general_ci, /* to_lower */ + to_upper_keybcs2_general_ci, /* to_upper */ sort_order_keybcs2_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_keybcs2_general_ci, /* to_uni */ + to_uni_keybcs2_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4304,11 +4442,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_macce_general_ci, /* ctype */ - to_lower_macce_general_ci, /* lower */ - to_upper_macce_general_ci, /* upper */ + to_lower_macce_general_ci, /* to_lower */ + to_upper_macce_general_ci, /* to_upper */ sort_order_macce_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_macce_general_ci, /* to_uni */ + to_uni_macce_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4337,11 +4475,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_macroman_general_ci, /* ctype */ - to_lower_macroman_general_ci, /* lower */ - to_upper_macroman_general_ci, /* upper */ + to_lower_macroman_general_ci, /* to_lower */ + to_upper_macroman_general_ci, /* to_upper */ sort_order_macroman_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_macroman_general_ci, /* to_uni */ + to_uni_macroman_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4370,11 +4508,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp852_general_ci, /* ctype */ - to_lower_cp852_general_ci, /* lower */ - to_upper_cp852_general_ci, /* upper */ + to_lower_cp852_general_ci, /* to_lower */ + to_upper_cp852_general_ci, /* to_upper */ sort_order_cp852_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp852_general_ci, /* to_uni */ + to_uni_cp852_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4403,11 +4541,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin7_general_ci, /* ctype */ - to_lower_latin7_general_ci, /* lower */ - to_upper_latin7_general_ci, /* upper */ + to_lower_latin7_general_ci, /* to_lower */ + to_upper_latin7_general_ci, /* to_upper */ sort_order_latin7_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin7_general_ci, /* to_uni */ + to_uni_latin7_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4436,11 +4574,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin7_general_ci, /* ctype */ - to_lower_latin7_general_ci, /* lower */ - to_upper_latin7_general_ci, /* upper */ + to_lower_latin7_general_ci, /* to_lower */ + to_upper_latin7_general_ci, /* to_upper */ sort_order_latin7_general_cs, /* sort_order */ NULL, /* uca */ - to_uni_latin7_general_ci, /* to_uni */ + to_uni_latin7_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4469,11 +4607,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_macce_general_ci, /* ctype */ - to_lower_macce_general_ci, /* lower */ - to_upper_macce_general_ci, /* upper */ + to_lower_macce_general_ci, /* to_lower */ + to_upper_macce_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_macce_general_ci, /* to_uni */ + to_uni_macce_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4502,11 +4640,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1250_general_ci, /* ctype */ - to_lower_cp1250_general_ci, /* lower */ - to_upper_cp1250_general_ci, /* upper */ + to_lower_cp1250_general_ci, /* to_lower */ + to_upper_cp1250_general_ci, /* to_upper */ sort_order_cp1250_croatian_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1250_general_ci, /* to_uni */ + to_uni_cp1250_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4535,11 +4673,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin1_general_ci, /* ctype */ - to_lower_latin1_general_ci, /* lower */ - to_upper_latin1_general_ci, /* upper */ + to_lower_latin1_general_ci, /* to_lower */ + to_upper_latin1_general_ci, /* to_upper */ sort_order_latin1_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin1_general_ci, /* to_uni */ + to_uni_latin1_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4568,11 +4706,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin1_general_cs, /* ctype */ - to_lower_latin1_general_cs, /* lower */ - to_upper_latin1_general_cs, /* upper */ + to_lower_latin1_general_cs, /* to_lower */ + to_upper_latin1_general_cs, /* to_upper */ sort_order_latin1_general_cs, /* sort_order */ NULL, /* uca */ - to_uni_latin1_general_cs, /* to_uni */ + to_uni_latin1_general_cs, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4601,11 +4739,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1251_general_ci, /* ctype */ - to_lower_cp1251_general_ci, /* lower */ - to_upper_cp1251_general_ci, /* upper */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp1251_general_ci, /* to_uni */ + to_uni_cp1251_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4634,11 +4772,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1251_general_ci, /* ctype */ - to_lower_cp1251_general_ci, /* lower */ - to_upper_cp1251_general_ci, /* upper */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ sort_order_cp1251_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1251_general_ci, /* to_uni */ + to_uni_cp1251_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4667,11 +4805,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1251_general_ci, /* ctype */ - to_lower_cp1251_general_ci, /* lower */ - to_upper_cp1251_general_ci, /* upper */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ sort_order_cp1251_general_cs, /* sort_order */ NULL, /* uca */ - to_uni_cp1251_general_ci, /* to_uni */ + to_uni_cp1251_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4700,11 +4838,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_macroman_general_ci, /* ctype */ - to_lower_macroman_general_ci, /* lower */ - to_upper_macroman_general_ci, /* upper */ + to_lower_macroman_general_ci, /* to_lower */ + to_upper_macroman_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_macroman_general_ci, /* to_uni */ + to_uni_macroman_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4733,11 +4871,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1256_general_ci, /* ctype */ - to_lower_cp1256_general_ci, /* lower */ - to_upper_cp1256_general_ci, /* upper */ + to_lower_cp1256_general_ci, /* to_lower */ + to_upper_cp1256_general_ci, /* to_upper */ sort_order_cp1256_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1256_general_ci, /* to_uni */ + to_uni_cp1256_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4766,11 +4904,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1257_general_ci, /* ctype */ - to_lower_cp1257_general_ci, /* lower */ - to_upper_cp1257_general_ci, /* upper */ + to_lower_cp1257_general_ci, /* to_lower */ + to_upper_cp1257_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp1257_general_ci, /* to_uni */ + to_uni_cp1257_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4799,11 +4937,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1257_general_ci, /* ctype */ - to_lower_cp1257_general_ci, /* lower */ - to_upper_cp1257_general_ci, /* upper */ + to_lower_cp1257_general_ci, /* to_lower */ + to_upper_cp1257_general_ci, /* to_upper */ sort_order_cp1257_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1257_general_ci, /* to_uni */ + to_uni_cp1257_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4832,11 +4970,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_armscii8_general_ci, /* ctype */ - to_lower_armscii8_general_ci, /* lower */ - to_upper_armscii8_general_ci, /* upper */ + to_lower_armscii8_general_ci, /* to_lower */ + to_upper_armscii8_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_armscii8_general_ci, /* to_uni */ + to_uni_armscii8_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4865,11 +5003,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_ascii_general_ci, /* ctype */ - to_lower_ascii_general_ci, /* lower */ - to_upper_ascii_general_ci, /* upper */ + to_lower_ascii_general_ci, /* to_lower */ + to_upper_ascii_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_ascii_general_ci, /* to_uni */ + to_uni_ascii_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4898,11 +5036,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1250_general_ci, /* ctype */ - to_lower_cp1250_general_ci, /* lower */ - to_upper_cp1250_general_ci, /* upper */ + to_lower_cp1250_general_ci, /* to_lower */ + to_upper_cp1250_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp1250_general_ci, /* to_uni */ + to_uni_cp1250_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4931,11 +5069,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1256_general_ci, /* ctype */ - to_lower_cp1256_general_ci, /* lower */ - to_upper_cp1256_general_ci, /* upper */ + to_lower_cp1256_general_ci, /* to_lower */ + to_upper_cp1256_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp1256_general_ci, /* to_uni */ + to_uni_cp1256_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4964,11 +5102,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp866_general_ci, /* ctype */ - to_lower_cp866_general_ci, /* lower */ - to_upper_cp866_general_ci, /* upper */ + to_lower_cp866_general_ci, /* to_lower */ + to_upper_cp866_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp866_general_ci, /* to_uni */ + to_uni_cp866_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -4997,11 +5135,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_dec8_swedish_ci, /* ctype */ - to_lower_dec8_swedish_ci, /* lower */ - to_upper_dec8_swedish_ci, /* upper */ + to_lower_dec8_swedish_ci, /* to_lower */ + to_upper_dec8_swedish_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_dec8_swedish_ci, /* to_uni */ + to_uni_dec8_swedish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5030,11 +5168,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_greek_general_ci, /* ctype */ - to_lower_greek_general_ci, /* lower */ - to_upper_greek_general_ci, /* upper */ + to_lower_greek_general_ci, /* to_lower */ + to_upper_greek_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_greek_general_ci, /* to_uni */ + to_uni_greek_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5063,11 +5201,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_hebrew_general_ci, /* ctype */ - to_lower_hebrew_general_ci, /* lower */ - to_upper_hebrew_general_ci, /* upper */ + to_lower_hebrew_general_ci, /* to_lower */ + to_upper_hebrew_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_hebrew_general_ci, /* to_uni */ + to_uni_hebrew_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5096,11 +5234,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_hp8_english_ci, /* ctype */ - to_lower_hp8_english_ci, /* lower */ - to_upper_hp8_english_ci, /* upper */ + to_lower_hp8_english_ci, /* to_lower */ + to_upper_hp8_english_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_hp8_english_ci, /* to_uni */ + to_uni_hp8_english_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5129,11 +5267,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_keybcs2_general_ci, /* ctype */ - to_lower_keybcs2_general_ci, /* lower */ - to_upper_keybcs2_general_ci, /* upper */ + to_lower_keybcs2_general_ci, /* to_lower */ + to_upper_keybcs2_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_keybcs2_general_ci, /* to_uni */ + to_uni_keybcs2_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5162,11 +5300,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_koi8r_general_ci, /* ctype */ - to_lower_koi8r_general_ci, /* lower */ - to_upper_koi8r_general_ci, /* upper */ + to_lower_koi8r_general_ci, /* to_lower */ + to_upper_koi8r_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_koi8r_general_ci, /* to_uni */ + to_uni_koi8r_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5195,11 +5333,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_koi8u_general_ci, /* ctype */ - to_lower_koi8u_general_ci, /* lower */ - to_upper_koi8u_general_ci, /* upper */ + to_lower_koi8u_general_ci, /* to_lower */ + to_upper_koi8u_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_koi8u_general_ci, /* to_uni */ + to_uni_koi8u_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5228,11 +5366,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin2_general_ci, /* ctype */ - to_lower_latin2_general_ci, /* lower */ - to_upper_latin2_general_ci, /* upper */ + to_lower_latin2_general_ci, /* to_lower */ + to_upper_latin2_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_latin2_general_ci, /* to_uni */ + to_uni_latin2_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5261,11 +5399,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin5_turkish_ci, /* ctype */ - to_lower_latin5_turkish_ci, /* lower */ - to_upper_latin5_turkish_ci, /* upper */ + to_lower_latin5_turkish_ci, /* to_lower */ + to_upper_latin5_turkish_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_latin5_turkish_ci, /* to_uni */ + to_uni_latin5_turkish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5294,11 +5432,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin7_general_ci, /* ctype */ - to_lower_latin7_general_ci, /* lower */ - to_upper_latin7_general_ci, /* upper */ + to_lower_latin7_general_ci, /* to_lower */ + to_upper_latin7_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_latin7_general_ci, /* to_uni */ + to_uni_latin7_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5327,11 +5465,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp850_general_ci, /* ctype */ - to_lower_cp850_general_ci, /* lower */ - to_upper_cp850_general_ci, /* upper */ + to_lower_cp850_general_ci, /* to_lower */ + to_upper_cp850_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp850_general_ci, /* to_uni */ + to_uni_cp850_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5360,11 +5498,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp852_general_ci, /* ctype */ - to_lower_cp852_general_ci, /* lower */ - to_upper_cp852_general_ci, /* upper */ + to_lower_cp852_general_ci, /* to_lower */ + to_upper_cp852_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_cp852_general_ci, /* to_uni */ + to_uni_cp852_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5393,11 +5531,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_swe7_swedish_ci, /* ctype */ - to_lower_swe7_swedish_ci, /* lower */ - to_upper_swe7_swedish_ci, /* upper */ + to_lower_swe7_swedish_ci, /* to_lower */ + to_upper_swe7_swedish_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_swe7_swedish_ci, /* to_uni */ + to_uni_swe7_swedish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5426,11 +5564,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_geostd8_general_ci, /* ctype */ - to_lower_geostd8_general_ci, /* lower */ - to_upper_geostd8_general_ci, /* upper */ + to_lower_geostd8_general_ci, /* to_lower */ + to_upper_geostd8_general_ci, /* to_upper */ sort_order_geostd8_general_ci, /* sort_order */ NULL, /* uca */ - to_uni_geostd8_general_ci, /* to_uni */ + to_uni_geostd8_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5459,11 +5597,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_geostd8_general_ci, /* ctype */ - to_lower_geostd8_general_ci, /* lower */ - to_upper_geostd8_general_ci, /* upper */ + to_lower_geostd8_general_ci, /* to_lower */ + to_upper_geostd8_general_ci, /* to_upper */ NULL, /* sort_order */ NULL, /* uca */ - to_uni_geostd8_general_ci, /* to_uni */ + to_uni_geostd8_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5492,11 +5630,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_latin1_spanish_ci, /* ctype */ - to_lower_latin1_spanish_ci, /* lower */ - to_upper_latin1_spanish_ci, /* upper */ + to_lower_latin1_spanish_ci, /* to_lower */ + to_upper_latin1_spanish_ci, /* to_upper */ sort_order_latin1_spanish_ci, /* sort_order */ NULL, /* uca */ - to_uni_latin1_spanish_ci, /* to_uni */ + to_uni_latin1_spanish_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5525,11 +5663,11 @@ struct charset_info_st compiled_charsets[] = { "", /* comment */ NULL, /* tailoring */ ctype_cp1250_general_ci, /* ctype */ - to_lower_cp1250_general_ci, /* lower */ - to_upper_cp1250_general_ci, /* upper */ + to_lower_cp1250_general_ci, /* to_lower */ + to_upper_cp1250_general_ci, /* to_upper */ sort_order_cp1250_polish_ci, /* sort_order */ NULL, /* uca */ - to_uni_cp1250_general_ci, /* to_uni */ + to_uni_cp1250_general_ci, /* to_uni */ NULL, /* from_uni */ &my_unicase_default, /* caseinfo */ NULL, /* state map */ @@ -5549,6 +5687,1524 @@ struct charset_info_st compiled_charsets[] = { } , #endif +#ifdef HAVE_CHARSET_dec8 +{ + 1027,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "dec8", /* cset name */ + "dec8_swedish_nopad_ci", /* coll name */ + "", /* comment */ + "[import dec8_swedish_ci]", /* tailoring */ + ctype_dec8_swedish_ci, /* ctype */ + to_lower_dec8_swedish_ci, /* to_lower */ + to_upper_dec8_swedish_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_dec8_swedish_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp850 +{ + 1028,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp850", /* cset name */ + "cp850_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp850_general_ci]", /* tailoring */ + ctype_cp850_general_ci, /* ctype */ + to_lower_cp850_general_ci, /* to_lower */ + to_upper_cp850_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp850_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hp8 +{ + 1030,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "hp8", /* cset name */ + "hp8_english_nopad_ci", /* coll name */ + "", /* comment */ + "[import hp8_english_ci]", /* tailoring */ + ctype_hp8_english_ci, /* ctype */ + to_lower_hp8_english_ci, /* to_lower */ + to_upper_hp8_english_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_hp8_english_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8r +{ + 1031,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "koi8r", /* cset name */ + "koi8r_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import koi8r_general_ci]", /* tailoring */ + ctype_koi8r_general_ci, /* ctype */ + to_lower_koi8r_general_ci, /* to_lower */ + to_upper_koi8r_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_koi8r_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin2 +{ + 1033,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "latin2", /* cset name */ + "latin2_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import latin2_general_ci]", /* tailoring */ + ctype_latin2_general_ci, /* ctype */ + to_lower_latin2_general_ci, /* to_lower */ + to_upper_latin2_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_latin2_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_swe7 +{ + 1034,0,0, + MY_CS_COMPILED|MY_CS_NONASCII|MY_CS_NOPAD, + "swe7", /* cset name */ + "swe7_swedish_nopad_ci", /* coll name */ + "", /* comment */ + "[import swe7_swedish_ci]", /* tailoring */ + ctype_swe7_swedish_ci, /* ctype */ + to_lower_swe7_swedish_ci, /* to_lower */ + to_upper_swe7_swedish_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_swe7_swedish_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_ascii +{ + 1035,0,0, + MY_CS_COMPILED|MY_CS_PUREASCII|MY_CS_NOPAD, + "ascii", /* cset name */ + "ascii_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import ascii_general_ci]", /* tailoring */ + ctype_ascii_general_ci, /* ctype */ + to_lower_ascii_general_ci, /* to_lower */ + to_upper_ascii_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_ascii_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hebrew +{ + 1040,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "hebrew", /* cset name */ + "hebrew_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import hebrew_general_ci]", /* tailoring */ + ctype_hebrew_general_ci, /* ctype */ + to_lower_hebrew_general_ci, /* to_lower */ + to_upper_hebrew_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_hebrew_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8u +{ + 1046,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "koi8u", /* cset name */ + "koi8u_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import koi8u_general_ci]", /* tailoring */ + ctype_koi8u_general_ci, /* ctype */ + to_lower_koi8u_general_ci, /* to_lower */ + to_upper_koi8u_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_koi8u_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_greek +{ + 1049,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "greek", /* cset name */ + "greek_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import greek_general_ci]", /* tailoring */ + ctype_greek_general_ci, /* ctype */ + to_lower_greek_general_ci, /* to_lower */ + to_upper_greek_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_greek_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1250 +{ + 1050,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp1250", /* cset name */ + "cp1250_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp1250_general_ci]", /* tailoring */ + ctype_cp1250_general_ci, /* ctype */ + to_lower_cp1250_general_ci, /* to_lower */ + to_upper_cp1250_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1250_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin5 +{ + 1054,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "latin5", /* cset name */ + "latin5_turkish_nopad_ci", /* coll name */ + "", /* comment */ + "[import latin5_turkish_ci]", /* tailoring */ + ctype_latin5_turkish_ci, /* ctype */ + to_lower_latin5_turkish_ci, /* to_lower */ + to_upper_latin5_turkish_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_latin5_turkish_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_armscii8 +{ + 1056,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "armscii8", /* cset name */ + "armscii8_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import armscii8_general_ci]", /* tailoring */ + ctype_armscii8_general_ci, /* ctype */ + to_lower_armscii8_general_ci, /* to_lower */ + to_upper_armscii8_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_armscii8_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp866 +{ + 1060,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp866", /* cset name */ + "cp866_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp866_general_ci]", /* tailoring */ + ctype_cp866_general_ci, /* ctype */ + to_lower_cp866_general_ci, /* to_lower */ + to_upper_cp866_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp866_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_keybcs2 +{ + 1061,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "keybcs2", /* cset name */ + "keybcs2_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import keybcs2_general_ci]", /* tailoring */ + ctype_keybcs2_general_ci, /* ctype */ + to_lower_keybcs2_general_ci, /* to_lower */ + to_upper_keybcs2_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_keybcs2_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macce +{ + 1062,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "macce", /* cset name */ + "macce_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import macce_general_ci]", /* tailoring */ + ctype_macce_general_ci, /* ctype */ + to_lower_macce_general_ci, /* to_lower */ + to_upper_macce_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_macce_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macroman +{ + 1063,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "macroman", /* cset name */ + "macroman_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import macroman_general_ci]", /* tailoring */ + ctype_macroman_general_ci, /* ctype */ + to_lower_macroman_general_ci, /* to_lower */ + to_upper_macroman_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_macroman_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp852 +{ + 1064,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp852", /* cset name */ + "cp852_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp852_general_ci]", /* tailoring */ + ctype_cp852_general_ci, /* ctype */ + to_lower_cp852_general_ci, /* to_lower */ + to_upper_cp852_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp852_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin7 +{ + 1065,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "latin7", /* cset name */ + "latin7_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import latin7_general_ci]", /* tailoring */ + ctype_latin7_general_ci, /* ctype */ + to_lower_latin7_general_ci, /* to_lower */ + to_upper_latin7_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_latin7_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macce +{ + 1067,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "macce", /* cset name */ + "macce_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_macce_general_ci, /* ctype */ + to_lower_macce_general_ci, /* to_lower */ + to_upper_macce_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_macce_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 1074,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp1251", /* cset name */ + "cp1251_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1251_general_ci, /* ctype */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1251_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 1075,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp1251", /* cset name */ + "cp1251_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp1251_general_ci]", /* tailoring */ + ctype_cp1251_general_ci, /* ctype */ + to_lower_cp1251_general_ci, /* to_lower */ + to_upper_cp1251_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1251_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macroman +{ + 1077,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "macroman", /* cset name */ + "macroman_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_macroman_general_ci, /* ctype */ + to_lower_macroman_general_ci, /* to_lower */ + to_upper_macroman_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_macroman_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1256 +{ + 1081,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp1256", /* cset name */ + "cp1256_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp1256_general_ci]", /* tailoring */ + ctype_cp1256_general_ci, /* ctype */ + to_lower_cp1256_general_ci, /* to_lower */ + to_upper_cp1256_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1256_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1257 +{ + 1082,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp1257", /* cset name */ + "cp1257_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1257_general_ci, /* ctype */ + to_lower_cp1257_general_ci, /* to_lower */ + to_upper_cp1257_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1257_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1257 +{ + 1083,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "cp1257", /* cset name */ + "cp1257_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import cp1257_general_ci]", /* tailoring */ + ctype_cp1257_general_ci, /* ctype */ + to_lower_cp1257_general_ci, /* to_lower */ + to_upper_cp1257_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1257_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_armscii8 +{ + 1088,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "armscii8", /* cset name */ + "armscii8_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_armscii8_general_ci, /* ctype */ + to_lower_armscii8_general_ci, /* to_lower */ + to_upper_armscii8_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_armscii8_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_ascii +{ + 1089,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PUREASCII|MY_CS_NOPAD, + "ascii", /* cset name */ + "ascii_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ascii_general_ci, /* ctype */ + to_lower_ascii_general_ci, /* to_lower */ + to_upper_ascii_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_ascii_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1250 +{ + 1090,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp1250", /* cset name */ + "cp1250_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1250_general_ci, /* ctype */ + to_lower_cp1250_general_ci, /* to_lower */ + to_upper_cp1250_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1250_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1256 +{ + 1091,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp1256", /* cset name */ + "cp1256_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1256_general_ci, /* ctype */ + to_lower_cp1256_general_ci, /* to_lower */ + to_upper_cp1256_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp1256_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp866 +{ + 1092,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp866", /* cset name */ + "cp866_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp866_general_ci, /* ctype */ + to_lower_cp866_general_ci, /* to_lower */ + to_upper_cp866_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp866_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_dec8 +{ + 1093,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "dec8", /* cset name */ + "dec8_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_dec8_swedish_ci, /* ctype */ + to_lower_dec8_swedish_ci, /* to_lower */ + to_upper_dec8_swedish_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_dec8_swedish_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_greek +{ + 1094,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "greek", /* cset name */ + "greek_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_greek_general_ci, /* ctype */ + to_lower_greek_general_ci, /* to_lower */ + to_upper_greek_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_greek_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hebrew +{ + 1095,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "hebrew", /* cset name */ + "hebrew_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_hebrew_general_ci, /* ctype */ + to_lower_hebrew_general_ci, /* to_lower */ + to_upper_hebrew_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_hebrew_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hp8 +{ + 1096,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "hp8", /* cset name */ + "hp8_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_hp8_english_ci, /* ctype */ + to_lower_hp8_english_ci, /* to_lower */ + to_upper_hp8_english_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_hp8_english_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_keybcs2 +{ + 1097,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "keybcs2", /* cset name */ + "keybcs2_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_keybcs2_general_ci, /* ctype */ + to_lower_keybcs2_general_ci, /* to_lower */ + to_upper_keybcs2_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_keybcs2_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8r +{ + 1098,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "koi8r", /* cset name */ + "koi8r_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_koi8r_general_ci, /* ctype */ + to_lower_koi8r_general_ci, /* to_lower */ + to_upper_koi8r_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_koi8r_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8u +{ + 1099,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "koi8u", /* cset name */ + "koi8u_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_koi8u_general_ci, /* ctype */ + to_lower_koi8u_general_ci, /* to_lower */ + to_upper_koi8u_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_koi8u_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin2 +{ + 1101,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "latin2", /* cset name */ + "latin2_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin2_general_ci, /* ctype */ + to_lower_latin2_general_ci, /* to_lower */ + to_upper_latin2_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_latin2_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin5 +{ + 1102,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "latin5", /* cset name */ + "latin5_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin5_turkish_ci, /* ctype */ + to_lower_latin5_turkish_ci, /* to_lower */ + to_upper_latin5_turkish_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_latin5_turkish_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin7 +{ + 1103,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "latin7", /* cset name */ + "latin7_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin7_general_ci, /* ctype */ + to_lower_latin7_general_ci, /* to_lower */ + to_upper_latin7_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_latin7_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp850 +{ + 1104,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp850", /* cset name */ + "cp850_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp850_general_ci, /* ctype */ + to_lower_cp850_general_ci, /* to_lower */ + to_upper_cp850_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp850_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp852 +{ + 1105,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "cp852", /* cset name */ + "cp852_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp852_general_ci, /* ctype */ + to_lower_cp852_general_ci, /* to_lower */ + to_upper_cp852_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_cp852_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_swe7 +{ + 1106,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NONASCII|MY_CS_NOPAD, + "swe7", /* cset name */ + "swe7_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_swe7_swedish_ci, /* ctype */ + to_lower_swe7_swedish_ci, /* to_lower */ + to_upper_swe7_swedish_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_swe7_swedish_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_geostd8 +{ + 1116,0,0, + MY_CS_COMPILED|MY_CS_NOPAD, + "geostd8", /* cset name */ + "geostd8_general_nopad_ci", /* coll name */ + "", /* comment */ + "[import geostd8_general_ci]", /* tailoring */ + ctype_geostd8_general_ci, /* ctype */ + to_lower_geostd8_general_ci, /* to_lower */ + to_upper_geostd8_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_geostd8_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_nopad_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_geostd8 +{ + 1117,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, + "geostd8", /* cset name */ + "geostd8_nopad_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_geostd8_general_ci, /* ctype */ + to_lower_geostd8_general_ci, /* to_lower */ + to_upper_geostd8_general_ci, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + to_uni_geostd8_general_ci, /* to_uni */ + NULL, /* from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_nopad_bin_handler, +} +, +#endif { 0,0,0, MY_CS_COMPILED, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index dbb92fabc4b..832c6c7f038 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -6343,6 +6343,20 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_chinese_nopad_ci +#define WEIGHT_MB1(x) (sort_order_gb2312[(uchar) (x)]) +#define WEIGHT_MB2(x,y) (gb2312code(x, y)) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_nopad_bin +#define WEIGHT_MB1(x) ((uchar) (x)) +#define WEIGHT_MB2(x,y) (gb2312code(x, y)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_handler_gb2312_chinese_ci= { NULL, /* init */ @@ -6375,6 +6389,37 @@ static MY_COLLATION_HANDLER my_collation_handler_gb2312_bin= }; +static MY_COLLATION_HANDLER my_collation_handler_gb2312_chinese_nopad_ci= +{ + NULL, /* init */ + my_strnncoll_gb2312_chinese_ci, + my_strnncollsp_gb2312_chinese_nopad_ci, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_handler_gb2312_nopad_bin= +{ + NULL, /* init */ + my_strnncoll_gb2312_bin, + my_strnncollsp_gb2312_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + static MY_CHARSET_HANDLER my_charset_handler= { @@ -6475,4 +6520,70 @@ struct charset_info_st my_charset_gb2312_bin= &my_collation_handler_gb2312_bin }; + +struct charset_info_st my_charset_gb2312_chinese_nopad_ci= +{ + MY_NOPAD_ID(24),0,0,/* number */ + MY_CS_COMPILED|MY_CS_NOPAD, /* state */ + "gb2312", /* cs name */ + "gb2312_chinese_nopad_ci",/* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gb2312, + to_lower_gb2312, + to_upper_gb2312, + sort_order_gb2312, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_gb2312,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xF7FE, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_gb2312_chinese_nopad_ci +}; + + +struct charset_info_st my_charset_gb2312_nopad_bin= +{ + MY_NOPAD_ID(86),0,0,/* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "gb2312", /* cs name */ + "gb2312_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gb2312, + to_lower_gb2312, + to_upper_gb2312, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_gb2312,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xF7FE, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_gb2312_nopad_bin +}; + #endif diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 617d72dc4d9..d24b77950c2 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -10625,6 +10625,21 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_chinese_nopad_ci +#define WEIGHT_MB1(x) (sort_order_gbk[(uchar) (x)]) +#define WEIGHT_MB2(x,y) (gbksortorder(gbkcode(x,y))) +#define DEFINE_STRNXFRM +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_nopad_bin +#define WEIGHT_MB1(x) ((uchar) (x)) +#define WEIGHT_MB2(x,y) (gbkcode(x,y)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_handler_gbk_chinese_ci= { NULL, /* init */ @@ -10657,6 +10672,36 @@ static MY_COLLATION_HANDLER my_collation_handler_gbk_bin= }; +static MY_COLLATION_HANDLER my_collation_handler_gbk_chinese_nopad_ci= +{ + NULL, /* init */ + my_strnncoll_gbk_chinese_ci, + my_strnncollsp_gbk_chinese_nopad_ci, + my_strnxfrm_gbk_chinese_nopad_ci, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_handler_gbk_nopad_bin= +{ + NULL, /* init */ + my_strnncoll_gbk_bin, + my_strnncollsp_gbk_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; static MY_CHARSET_HANDLER my_charset_handler= { @@ -10757,4 +10802,68 @@ struct charset_info_st my_charset_gbk_bin= }; +struct charset_info_st my_charset_gbk_chinese_nopad_ci= +{ + MY_NOPAD_ID(28),0,0,/* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NOPAD, /* state */ + "gbk", /* cs name */ + "gbk_chinese_nopad_ci",/* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gbk, + to_lower_gbk, + to_upper_gbk, + sort_order_gbk, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_gbk, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xA967, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_gbk_chinese_nopad_ci +}; + +struct charset_info_st my_charset_gbk_nopad_bin= +{ + MY_NOPAD_ID(87),0,0,/* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "gbk", /* cs name */ + "gbk_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gbk, + to_lower_gbk, + to_upper_gbk, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_gbk, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_gbk_nopad_bin +}; + #endif diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index fe255349530..6f71c7a0c76 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -460,6 +460,39 @@ struct charset_info_st my_charset_latin1= }; +struct charset_info_st my_charset_latin1_nopad= +{ + MY_NOPAD_ID(8),0,0, /* number */ + MY_CS_COMPILED | MY_CS_NOPAD, /* state */ + "latin1", /* cs name */ + "latin1_swedish_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + sort_order_latin1, + NULL, /* uca */ + cs_to_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_8bit_simple_nopad_ci_handler +}; + + /* @@ -770,3 +803,36 @@ struct charset_info_st my_charset_latin1_bin= &my_collation_8bit_bin_handler }; + +struct charset_info_st my_charset_latin1_nopad_bin= +{ + MY_NOPAD_ID(47),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD,/* state */ + "latin1", /* cs name */ + "latin1_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + NULL, /* sort_order */ + NULL, /* uca */ + cs_to_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_8bit_nopad_bin_handler +}; + diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 56b3309ca10..d78e758010d 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -602,13 +602,10 @@ uint my_instr_mb(CHARSET_INFO *cs, characters having multibyte weights *equal* to their codes: cp932, euckr, gb2312, sjis, eucjpms, ujis. */ -size_t -my_strnxfrm_mb(CHARSET_INFO *cs, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags) +size_t my_strnxfrm_mb_internal(CHARSET_INFO *cs, uchar *dst, uchar *de, + uint *nweights, const uchar *src, size_t srclen) { uchar *d0= dst; - uchar *de= dst + dstlen; const uchar *se= src + srclen; const uchar *sort_order= cs->sort_order; @@ -619,12 +616,12 @@ my_strnxfrm_mb(CHARSET_INFO *cs, then we can run a simplified loop - without checking "nweights" and "de". */ - if (dstlen >= srclen && nweights >= srclen) + if (de >= d0 + srclen && *nweights >= srclen) { if (sort_order) { /* Optimized version for a case insensitive collation */ - for (; src < se; nweights--) + for (; src < se; (*nweights)--) { if (*src < 128) /* quickly catch ASCII characters */ *dst++= sort_order[*src++]; @@ -635,7 +632,7 @@ my_strnxfrm_mb(CHARSET_INFO *cs, else { /* Optimized version for a case sensitive collation (no sort_order) */ - for (; src < se; nweights--) + for (; src < se; (*nweights)--) { if (*src < 128) /* quickly catch ASCII characters */ *dst++= *src++; @@ -643,14 +640,14 @@ my_strnxfrm_mb(CHARSET_INFO *cs, my_strnxfrm_mb_non_ascii_char(cs, dst, src, se); } } - goto pad; + goto end; } /* A thourough loop, checking all possible limits: "se", "nweights" and "de". */ - for (; src < se && nweights && dst < de; nweights--) + for (; src < se && *nweights && dst < de; (*nweights)--) { int chlen; if (*src < 128 || !(chlen= my_ismbchar(cs, (const char *) src, @@ -669,11 +666,36 @@ my_strnxfrm_mb(CHARSET_INFO *cs, } } -pad: +end: + return dst - d0; +} + + +size_t +my_strnxfrm_mb(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *de= dst + dstlen; + uchar *d0= dst; + dst= d0 + my_strnxfrm_mb_internal(cs, dst, de, &nweights, src, srclen); return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); } +size_t +my_strnxfrm_mb_nopad(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *de= dst + dstlen; + uchar *d0= dst; + dst= d0 + my_strnxfrm_mb_internal(cs, dst, de, &nweights, src, srclen); + return my_strxfrm_pad_desc_and_reverse_nopad(cs, d0, dst, de, nweights, + flags, 0); +} + + int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), const char *s, const char *t) @@ -682,18 +704,13 @@ my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), } + void -my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, size_t len,ulong *nr1, ulong *nr2) +my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) { register ulong m1= *nr1, m2= *nr2; - - /* - Remove trailing spaces. We have to do this to be able to compare - 'A ' and 'A' as identical - */ - const uchar *end = skip_trailing_space(key, len); - + const uchar *end= key + len; for (; key < end ; key++) { MY_HASH_ADD(m1, m2, (uint)*key); @@ -703,6 +720,19 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), } +void +my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) +{ + /* + Remove trailing spaces. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + const uchar *end= skip_trailing_space(key, len); + my_hash_sort_mb_nopad_bin(cs, key, end - key, nr1, nr2); +} + + /* Fill the given buffer with 'maximum character' for given charset SYNOPSIS diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index f02d96aa798..b142aab18a6 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -71,14 +71,14 @@ size_t my_strnxfrmlen_simple(CHARSET_INFO *cs, size_t len) */ -size_t my_strnxfrm_simple(CHARSET_INFO * cs, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags) +size_t my_strnxfrm_simple_internal(CHARSET_INFO * cs, + uchar *dst, size_t dstlen, uint *nweights, + const uchar *src, size_t srclen) { const uchar *map= cs->sort_order; uchar *d0= dst; uint frmlen; - if ((frmlen= MY_MIN(dstlen, nweights)) > srclen) + if ((frmlen= MY_MIN(dstlen, *nweights)) > srclen) frmlen= srclen; if (dst != src) { @@ -92,8 +92,32 @@ size_t my_strnxfrm_simple(CHARSET_INFO * cs, for (end= dst + frmlen; dst < end; dst++) *dst= map[(uchar) *dst]; } + *nweights-= frmlen; + return dst - d0; +} + + +size_t my_strnxfrm_simple(CHARSET_INFO * cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *d0= dst; + dst= d0 + my_strnxfrm_simple_internal(cs, dst, dstlen, &nweights, + src, srclen); return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, d0 + dstlen, - nweights - frmlen, flags, 0); + nweights, flags, 0); +} + + +size_t my_strnxfrm_simple_nopad(CHARSET_INFO * cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *d0= dst; + dst= d0 + my_strnxfrm_simple_internal(cs, dst, dstlen, &nweights, + src, srclen); + return my_strxfrm_pad_desc_and_reverse_nopad(cs, d0, dst, d0 + dstlen, + nweights, flags, 0); } @@ -184,6 +208,14 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, } +int my_strnncollsp_simple_nopad(CHARSET_INFO * cs, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length) +{ + return my_strnncoll_simple(cs, a, a_length, b, b_length, FALSE); +} + + size_t my_caseup_str_8bit(CHARSET_INFO * cs,char *str) { register const uchar *map= cs->to_upper; @@ -297,13 +329,28 @@ size_t my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), } +void my_hash_sort_simple_nopad(CHARSET_INFO *cs, + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) +{ + register const uchar *sort_order=cs->sort_order; + const uchar *end= key + len; + register ulong m1= *nr1, m2= *nr2; + for (; key < (uchar*) end ; key++) + { + MY_HASH_ADD(m1, m2, (uint) sort_order[(uint) *key]); + } + *nr1= m1; + *nr2= m2; +} + + void my_hash_sort_simple(CHARSET_INFO *cs, - const uchar *key, size_t len, - ulong *nr1, ulong *nr2) + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) { register const uchar *sort_order=cs->sort_order; const uchar *end; - register ulong m1= *nr1, m2= *nr2; uint16 space_weight= sort_order[' ']; /* @@ -338,13 +385,7 @@ void my_hash_sort_simple(CHARSET_INFO *cs, break; } } - - for (; key < (uchar*) end ; key++) - { - MY_HASH_ADD(m1, m2, (uint) sort_order[(uint) *key]); - } - *nr1= m1; - *nr2= m2; + my_hash_sort_simple_nopad(cs, key, end - key, nr1, nr2); } @@ -1996,6 +2037,28 @@ my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, } +size_t +my_strxfrm_pad_desc_and_reverse_nopad(CHARSET_INFO *cs, + uchar *str, uchar *frmend, uchar *strend, + uint nweights, uint flags, uint level) +{ + if (nweights && frmend < strend && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + uint fill_length= MY_MIN((uint) (strend - frmend), nweights * cs->mbminlen); + memset(frmend, 0x00, fill_length); + frmend+= fill_length; + } + my_strxfrm_desc_and_reverse(str, frmend, flags, level); + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && frmend < strend) + { + uint fill_length= strend - frmend; + memset(frmend, 0x00, fill_length); + frmend= strend; + } + return frmend - str; +} + + MY_CHARSET_HANDLER my_charset_8bit_handler= { my_cset_init_8bit, @@ -2043,3 +2106,19 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler = my_hash_sort_simple, my_propagate_simple }; + + +MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler = +{ + my_coll_init_simple, /* init */ + my_strnncoll_simple, + my_strnncollsp_simple_nopad, + my_strnxfrm_simple_nopad, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_8bit, + my_strcasecmp_8bit, + my_instr_simple, + my_hash_sort_simple_nopad, + my_propagate_simple +}; diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index e0546146008..94fd69c79c0 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -34025,6 +34025,22 @@ size_t my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _sjis_japanese_nopad_ci +#define WEIGHT_PAD_SPACE (256 * (int) ' ') +#define WEIGHT_MB1(x) (256 * (int) sort_order_sjis[(uchar) (x)]) +#define WEIGHT_MB2(x,y) (sjiscode(x, y)) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _sjis_nopad_bin +#define WEIGHT_PAD_SPACE (256 * (int) ' ') +#define WEIGHT_MB1(x) (256 * (int) (uchar) (x)) +#define WEIGHT_MB2(x,y) (sjiscode(x, y)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_handler_sjis_japanese_ci= { NULL, /* init */ @@ -34057,6 +34073,38 @@ static MY_COLLATION_HANDLER my_collation_handler_sjis_bin= }; +static MY_COLLATION_HANDLER my_collation_handler_sjis_japanese_nopad_ci= +{ + NULL, /* init */ + my_strnncoll_sjis_japanese_ci, + my_strnncollsp_sjis_japanese_nopad_ci, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_8bit, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_handler_sjis_nopad_bin= +{ + NULL, /* init */ + my_strnncoll_sjis_bin, + my_strnncollsp_sjis_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -34155,4 +34203,69 @@ struct charset_info_st my_charset_sjis_bin= &my_collation_handler_sjis_bin }; + +struct charset_info_st my_charset_sjis_japanese_nopad_ci= +{ + MY_NOPAD_ID(13),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NONASCII|MY_CS_NOPAD, /* state */ + "sjis", /* cs name */ + "sjis_japanese_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_sjis, + to_lower_sjis, + to_upper_sjis, + sort_order_sjis, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_sjis, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFCFC, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_sjis_japanese_nopad_ci +}; + +struct charset_info_st my_charset_sjis_nopad_bin= +{ + MY_NOPAD_ID(88),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NONASCII|MY_CS_NOPAD, /* state */ + "sjis", /* cs name */ + "sjis_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_sjis, + to_lower_sjis, + to_upper_sjis, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_sjis, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFCFC, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_handler_sjis_nopad_bin +}; + #endif diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 7f3bdc9140a..72a33036085 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -541,7 +541,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), static int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), - const uchar *a0, size_t a_length, + const uchar *a0, size_t a_length, const uchar *b0, size_t b_length) { uchar buf[80], *end, *a, *b, *alloced= NULL; @@ -583,6 +583,13 @@ ret: } +static +int my_strnncollsp_tis620_nopad(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a0, size_t a_length, + const uchar *b0, size_t b_length) +{ + return my_strnncoll_tis620(cs, a0, a_length, b0, b_length, FALSE); +} /* strnxfrm replacment, convert Thai string to sortable string @@ -613,6 +620,29 @@ my_strnxfrm_tis620(CHARSET_INFO *cs, } +static size_t +my_strnxfrm_tis620_nopad(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + size_t len, dstlen0= dstlen; + len= (uint) (strmake((char*) dst, (char*) src, MY_MIN(dstlen, srclen)) - + (char*) dst); + len= thai2sortable(dst, len); + set_if_smaller(dstlen, nweights); + set_if_smaller(len, dstlen); + len= my_strxfrm_pad_desc_and_reverse_nopad(cs, dst, dst + len, dst + dstlen, + dstlen - len, flags, 0); + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0) + { + uint fill_length= dstlen0 - len; + memset(dst + len, 0x00, fill_length); + len= dstlen0; + } + return len; +} + + static const unsigned short cs_to_uni[256]={ 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, @@ -830,6 +860,21 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_propagate_simple }; +static MY_COLLATION_HANDLER my_collation_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_tis620, + my_strnncollsp_tis620_nopad, + my_strnxfrm_tis620_nopad, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_8bit, /* wildcmp */ + my_strcasecmp_8bit, + my_instr_simple, /* QQ: To be fixed */ + my_hash_sort_simple_nopad, + my_propagate_simple +}; + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -930,4 +975,70 @@ struct charset_info_st my_charset_tis620_bin= }; +struct charset_info_st my_charset_tis620_thai_nopad_ci= +{ + MY_NOPAD_ID(18),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_NON1TO1|MY_CS_NOPAD, /* state */ + "tis620", /* cs name */ + "tis620_thai_nopad_ci",/* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_tis620, + to_lower_tis620, + to_upper_tis620, + sort_order_tis620, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_nopad_ci_handler +}; + + +struct charset_info_st my_charset_tis620_nopad_bin= +{ + MY_NOPAD_ID(89),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "tis620", /* cs name */ + "tis620_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_tis620, + to_lower_tis620, + to_upper_tis620, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_8bit_nopad_bin_handler +}; + + #endif diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 06dab08a772..9d8353103f0 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1243,6 +1243,20 @@ static inline int my_weight_mb2_utf16mb2_general_ci(uchar b0, uchar b1) #define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b0, b1, b2, b3)) #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16_general_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf16mb2_general_ci(b0,b1) +#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER +#include "strcoll.ic" + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) ((int) MY_UTF16_WC2(b0, b1)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b0, b1, b2, b3)) +#include "strcoll.ic" + #undef IS_MB2_CHAR #undef IS_MB4_CHAR @@ -1370,13 +1384,14 @@ my_caseup_utf16(CHARSET_INFO *cs, char *src, size_t srclen, static void -my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen, - ulong *nr1, ulong *nr2) +my_hash_sort_utf16_nopad(CHARSET_INFO *cs, + const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) { my_wc_t wc; my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc; int res; - const uchar *e= s + cs->cset->lengthsp(cs, (const char *) s, slen); + const uchar *e= s + slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; @@ -1391,6 +1406,15 @@ my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen, } +static void +my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) +{ + size_t lengthsp= cs->cset->lengthsp(cs, (const char *) s, slen); + my_hash_sort_utf16_nopad(cs, s, lengthsp, nr1, nr2); +} + + static size_t my_casedn_utf16(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), @@ -1511,10 +1535,11 @@ my_wildcmp_utf16_bin(CHARSET_INFO *cs, static void -my_hash_sort_utf16_bin(CHARSET_INFO *cs, - const uchar *pos, size_t len, ulong *nr1, ulong *nr2) +my_hash_sort_utf16_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *pos, size_t len, + ulong *nr1, ulong *nr2) { - const uchar *end= pos + cs->cset->lengthsp(cs, (const char *) pos, len); + const uchar *end= pos + len; register ulong m1= *nr1, m2= *nr2; for ( ; pos < end ; pos++) @@ -1526,6 +1551,15 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs, } +static void +my_hash_sort_utf16_bin(CHARSET_INFO *cs, + const uchar *pos, size_t len, ulong *nr1, ulong *nr2) +{ + size_t lengthsp= cs->cset->lengthsp(cs, (const char *) pos, len); + my_hash_sort_utf16_nopad_bin(cs, pos, lengthsp, nr1, nr2); +} + + static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler = { NULL, /* init */ @@ -1558,6 +1592,38 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_utf16_general_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf16_general_ci, + my_strnncollsp_utf16_general_nopad_ci, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_generic, + my_wildcmp_utf16_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_utf16_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf16_bin, + my_strnncollsp_utf16_nopad_bin, + my_strnxfrm_unicode_full_nopad_bin, + my_strnxfrmlen_unicode_full_bin, + my_like_range_generic, + my_wildcmp_utf16_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16_nopad_bin, + my_propagate_simple +}; + + MY_CHARSET_HANDLER my_charset_utf16_handler= { NULL, /* init */ @@ -1658,6 +1724,73 @@ struct charset_info_st my_charset_utf16_bin= }; +struct charset_info_st my_charset_utf16_general_nopad_ci= +{ + MY_NOPAD_ID(54),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII|MY_CS_NOPAD, + "utf16", /* cs name */ + "utf16_general_nopad_ci", /* name */ + "UTF-16 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_general_nopad_ci_handler +}; + + +struct charset_info_st my_charset_utf16_nopad_bin= +{ + MY_NOPAD_ID(55),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII| + MY_CS_NOPAD, + "utf16", /* cs name */ + "utf16_nopad_bin", /* name */ + "UTF-16 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_nopad_bin_handler +}; + + #define IS_MB2_CHAR(b0,b1) (!MY_UTF16_SURROGATE_HEAD(b1)) #define IS_MB4_CHAR(b0,b1,b2,b3) (MY_UTF16_HIGH_HEAD(b1) && MY_UTF16_LOW_HEAD(b3)) @@ -1673,6 +1806,20 @@ struct charset_info_st my_charset_utf16_bin= #define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b1, b0, b3, b2)) #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16le_general_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf16mb2_general_ci(b1,b0) +#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER +#include "strcoll.ic" + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16le_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) ((int) MY_UTF16_WC2(b1, b0)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b1, b0, b3, b2)) +#include "strcoll.ic" + #undef IS_MB2_CHAR #undef IS_MB4_CHAR @@ -1779,6 +1926,38 @@ static MY_COLLATION_HANDLER my_collation_utf16le_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_utf16le_general_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf16le_general_ci, + my_strnncollsp_utf16le_general_nopad_ci, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_generic, + my_wildcmp_utf16_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_utf16le_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf16le_bin, + my_strnncollsp_utf16le_nopad_bin, + my_strnxfrm_unicode_full_nopad_bin, + my_strnxfrmlen_unicode_full_bin, + my_like_range_generic, + my_wildcmp_utf16_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_utf16le_handler= { NULL, /* init */ @@ -1879,6 +2058,73 @@ struct charset_info_st my_charset_utf16le_bin= }; +struct charset_info_st my_charset_utf16le_general_nopad_ci= +{ + MY_NOPAD_ID(56),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII|MY_CS_NOPAD, + "utf16le", /* cs name */ + "utf16le_general_nopad_ci",/* name */ + "UTF-16LE Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf16le_handler, + &my_collation_utf16le_general_nopad_ci_handler +}; + + +struct charset_info_st my_charset_utf16le_nopad_bin= +{ + MY_NOPAD_ID(62),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII| + MY_CS_NOPAD, + "utf16le", /* cs name */ + "utf16le_nopad_bin", /* name */ + "UTF-16LE Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf16le_handler, + &my_collation_utf16le_nopad_bin_handler +}; + + #endif /* HAVE_CHARSET_utf16 */ @@ -1916,6 +2162,18 @@ static inline int my_weight_utf32_general_ci(uchar b0, uchar b1, #define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF32_WC4(b0, b1, b2, b3)) #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf32_general_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB4(b0,b1,b2,b3) my_weight_utf32_general_ci(b0, b1, b2, b3) +#include "strcoll.ic" + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf32_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF32_WC4(b0, b1, b2, b3)) +#include "strcoll.ic" + #undef IS_MB2_CHAR #undef IS_MB4_CHAR @@ -1984,6 +2242,18 @@ my_tosort_utf32(MY_UNICASE_INFO *uni_plane, my_wc_t *wc) static size_t +my_lengthsp_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) +{ + const char *end= ptr + length; + DBUG_ASSERT((length % 4) == 0); + while (end > ptr + 3 && end[-1] == ' ' && !end[-2] && !end[-3] && !end[-4]) + end-= 4; + return (size_t) (end - ptr); +} + + +static size_t my_caseup_utf32(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), size_t dstlen __attribute__((unused))) @@ -2007,8 +2277,8 @@ my_caseup_utf32(CHARSET_INFO *cs, char *src, size_t srclen, static void -my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, - ulong *nr1, ulong *nr2) +my_hash_sort_utf32_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) { my_wc_t wc; int res; @@ -2016,10 +2286,6 @@ my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; - /* Skip trailing spaces */ - while (e > s + 3 && e[-1] == ' ' && !e[-2] && !e[-3] && !e[-4]) - e-= 4; - while ((res= my_utf32_uni(cs, &wc, (uchar*) s, (uchar*) e)) > 0) { my_tosort_utf32(uni_plane, &wc); @@ -2034,6 +2300,15 @@ my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, } +static void +my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) +{ + size_t lengthsp= my_lengthsp_utf32(cs, (const char *) s, slen); + my_hash_sort_utf32_nopad(cs, s, lengthsp, nr1, nr2); +} + + static size_t my_casedn_utf32(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), @@ -2415,18 +2690,6 @@ void my_fill_utf32(CHARSET_INFO *cs, } -static size_t -my_lengthsp_utf32(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, size_t length) -{ - const char *end= ptr + length; - DBUG_ASSERT((length % 4) == 0); - while (end > ptr + 3 && end[-1] == ' ' && !end[-2] && !end[-3] && !end[-4]) - end-= 4; - return (size_t) (end - ptr); -} - - static int my_wildcmp_utf32_ci(CHARSET_INFO *cs, const char *str, const char *str_end, @@ -2509,6 +2772,38 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_utf32_general_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf32_general_ci, + my_strnncollsp_utf32_general_nopad_ci, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_generic, + my_wildcmp_utf32_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf32_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_utf32_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf32_bin, + my_strnncollsp_utf32_nopad_bin, + my_strnxfrm_unicode_full_nopad_bin, + my_strnxfrmlen_unicode_full_bin, + my_like_range_generic, + my_wildcmp_utf32_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf32_nopad, + my_propagate_simple +}; + + MY_CHARSET_HANDLER my_charset_utf32_handler= { NULL, /* init */ @@ -2609,6 +2904,73 @@ struct charset_info_st my_charset_utf32_bin= }; +struct charset_info_st my_charset_utf32_general_nopad_ci= +{ + MY_NOPAD_ID(60),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII|MY_CS_NOPAD, + "utf32", /* cs name */ + "utf32_general_nopad_ci", /* name */ + "UTF-32 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_general_nopad_ci_handler +}; + + +struct charset_info_st my_charset_utf32_nopad_bin= +{ + MY_NOPAD_ID(61),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII| + MY_CS_NOPAD, + "utf32", /* cs name */ + "utf32_nopad_bin", /* name */ + "UTF-32 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_nopad_bin_handler +}; + + #endif /* HAVE_CHARSET_utf32 */ @@ -2698,6 +3060,20 @@ static inline int my_weight_mb2_ucs2_general_ci(uchar b0, uchar b1) #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _ucs2_general_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_ucs2_general_ci(b0,b1) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _ucs2_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) UCS2_CODE(b0,b1) +#include "strcoll.ic" + + static int my_charlen_ucs2(CHARSET_INFO *cs __attribute__((unused)), const uchar *s, const uchar *e) @@ -2779,8 +3155,9 @@ static size_t my_caseup_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, } -static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, - ulong *nr1, ulong *nr2) +static void +my_hash_sort_ucs2_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) { my_wc_t wc; int res; @@ -2788,9 +3165,6 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; - while (e > s+1 && e[-1] == ' ' && e[-2] == '\0') - e-= 2; - while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e)) >0) { my_tosort_ucs2(uni_plane, &wc); @@ -2802,6 +3176,13 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, } +static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) +{ + size_t lengthsp= my_lengthsp_mb2(cs, (const char *) s, slen); + my_hash_sort_ucs2_nopad(cs, s, lengthsp, nr1, nr2); +} + static size_t my_casedn_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, char *dst __attribute__((unused)), size_t dstlen __attribute__((unused))) @@ -2928,17 +3309,14 @@ int my_wildcmp_ucs2_bin(CHARSET_INFO *cs, } -static -void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *key, size_t len,ulong *nr1, ulong *nr2) +static void +my_hash_sort_ucs2_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) { - const uchar *end = key + len; + const uchar *end= key + len; register ulong m1= *nr1, m2= *nr2; - - while (end > key+1 && end[-1] == ' ' && end[-2] == '\0') - end-= 2; - - for (; key < (uchar*) end ; key++) + for ( ; key < end ; key++) { MY_HASH_ADD(m1, m2, (uint)*key); } @@ -2947,6 +3325,15 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), } +static void +my_hash_sort_ucs2_bin(CHARSET_INFO *cs, + const uchar *key, size_t len, ulong *nr1, ulong *nr2) +{ + size_t lengthsp= my_lengthsp_mb2(cs, (const char *) key, len); + my_hash_sort_ucs2_nopad_bin(cs, key, lengthsp, nr1, nr2); +} + + static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler = { NULL, /* init */ @@ -2979,6 +3366,38 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_ucs2_general_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_ucs2_general_ci, + my_strnncollsp_ucs2_general_nopad_ci, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_generic, + my_wildcmp_ucs2_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_ucs2_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_ucs2_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_ucs2_bin, + my_strnncollsp_ucs2_nopad_bin, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_generic, + my_wildcmp_ucs2_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_ucs2_nopad_bin, + my_propagate_simple +}; + + MY_CHARSET_HANDLER my_charset_ucs2_handler= { NULL, /* init */ @@ -3112,4 +3531,69 @@ struct charset_info_st my_charset_ucs2_bin= }; +struct charset_info_st my_charset_ucs2_general_nopad_ci= +{ + MY_NOPAD_ID(35),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII|MY_CS_NOPAD, + "ucs2", /* cs name */ + "ucs2_general_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ucs2, /* ctype */ + to_lower_ucs2, /* to_lower */ + to_upper_ucs2, /* to_upper */ + to_upper_ucs2, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_general_nopad_ci_handler +}; + + +struct charset_info_st my_charset_ucs2_nopad_bin= +{ + MY_NOPAD_ID(90),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE|MY_CS_NONASCII|MY_CS_NOPAD, + "ucs2", /* cs name */ + "ucs2_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ucs2, /* ctype */ + to_lower_ucs2, /* to_lower */ + to_upper_ucs2, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_nopad_bin_handler +}; + #endif /* HAVE_CHARSET_ucs2 */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 786ae991aef..8c08e906284 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -220,6 +220,26 @@ static const uchar sort_order_ujis[]= #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis_japanese_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) sort_order_ujis[(uchar) (x)]) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) (uchar) (x)) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + + static size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), const char *str, const char *str_end) @@ -67246,6 +67266,38 @@ static MY_COLLATION_HANDLER my_collation_ujis_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_ujis_japanese_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_ujis_japanese_ci, + my_strnncollsp_ujis_japanese_nopad_ci, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple_nopad, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_ujis_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_ujis_bin, + my_strnncollsp_ujis_nopad_bin, + my_strnxfrm_mb_nopad, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -67347,4 +67399,70 @@ struct charset_info_st my_charset_ujis_bin= }; +struct charset_info_st my_charset_ujis_japanese_nopad_ci= +{ + MY_NOPAD_ID(12),0,0,/* number */ + MY_CS_COMPILED|MY_CS_NOPAD, /* state */ + "ujis", /* cs name */ + "ujis_japanese_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ujis, + to_lower_ujis, + to_upper_ujis, + sort_order_ujis, + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_ujis, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 2, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ujis_japanese_nopad_ci_handler +}; + + +struct charset_info_st my_charset_ujis_nopad_bin= +{ + MY_NOPAD_ID(91),0,0,/* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */ + "ujis", /* cs name */ + "ujis_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ujis, + to_lower_ujis, + to_upper_ujis, + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_caseinfo_ujis, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 2, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFEFE, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ujis_nopad_bin_handler +}; + + #endif /* HAVE_CHARSET_ujis */ diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 494e292aac6..39d3521baa4 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -111,7 +111,9 @@ #define MY_UTF8MB3_BIN MY_UTF8MB3 "_bin" #define MY_UTF8MB4_GENERAL_CI MY_UTF8MB4 "_general_ci" #define MY_UTF8MB4_GENERAL_CS MY_UTF8MB4 "_general_cs" +#define MY_UTF8MB4_GENERAL_NOPAD_CI MY_UTF8MB4 "_general_nopad_ci" #define MY_UTF8MB4_BIN MY_UTF8MB4 "_bin" +#define MY_UTF8MB4_NOPAD_BIN MY_UTF8MB4 "_nopad_bin" @@ -4692,30 +4694,19 @@ my_strxfrm_pad_unicode(uchar *str, uchar *strend) } -/* - Store sorting weights using 2 bytes per character. - - This function is shared between - - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin - which support BMP only (U+0000..U+FFFF). - - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci, - which map all supplementary characters to weight 0xFFFD. -*/ -size_t -my_strnxfrm_unicode(CHARSET_INFO *cs, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags) +size_t my_strnxfrm_unicode_internal(CHARSET_INFO *cs, + uchar *dst, uchar *de, uint *nweights, + const uchar *src, const uchar *se) { my_wc_t UNINIT_VAR(wc); int res; uchar *dst0= dst; - uchar *de= dst + dstlen; - const uchar *se= src + srclen; MY_UNICASE_INFO *uni_plane= (cs->state & MY_CS_BINSORT) ? NULL : cs->caseinfo; - DBUG_ASSERT(!srclen || src); - for (; dst < de && nweights; nweights--) + DBUG_ASSERT(src || !se); + + for (; dst < de && *nweights; (*nweights)--) { if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0) break; @@ -4728,6 +4719,29 @@ my_strnxfrm_unicode(CHARSET_INFO *cs, if (dst < de) *dst++= (uchar) (wc & 0xFF); } + return dst - dst0; +} + + +/* + Store sorting weights using 2 bytes per character. + + This function is shared between + - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin + which support BMP only (U+0000..U+FFFF). + - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci, + which map all supplementary characters to weight 0xFFFD. +*/ +size_t +my_strnxfrm_unicode(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *dst0= dst; + uchar *de= dst + dstlen; + dst+= my_strnxfrm_unicode_internal(cs, dst, de, &nweights, + src, src + srclen); + DBUG_ASSERT(dst <= de); /* Safety */ if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) dst+= my_strxfrm_pad_nweights_unicode(dst, de, nweights); @@ -4740,6 +4754,35 @@ my_strnxfrm_unicode(CHARSET_INFO *cs, } +size_t +my_strnxfrm_unicode_nopad(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *dst0= dst; + uchar *de= dst + dstlen; + dst+= my_strnxfrm_unicode_internal(cs, dst, de, &nweights, + src, src + srclen); + DBUG_ASSERT(dst <= de); /* Safety */ + + if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + size_t len= de - dst; + set_if_smaller(len, nweights * 2); + memset(dst, 0x00, len); + dst+= len; + } + + my_strxfrm_desc_and_reverse(dst0, dst, flags, 0); + + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de) + { + memset(dst, 0x00, de - dst); + dst= de; + } + return dst - dst0; +} + /* For BMP-only collations that use 2 bytes per weight. */ @@ -4750,24 +4793,18 @@ my_strnxfrmlen_unicode(CHARSET_INFO *cs, size_t len) return ((len + cs->mbmaxlen - 1) / cs->mbmaxlen) * 2; } -/* - Store sorting weights using 3 bytes per character. - This function is shared between utf8mb4_bin, utf16_bin, utf32_bin. -*/ size_t -my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags) +my_strnxfrm_unicode_full_bin_internal(CHARSET_INFO *cs, + uchar *dst, uchar *de, uint *nweights, + const uchar *src, const uchar *se) { my_wc_t UNINIT_VAR(wc); uchar *dst0= dst; - uchar *de= dst + dstlen; - const uchar *se = src + srclen; - DBUG_ASSERT(!srclen || src); + DBUG_ASSERT(src || !se); DBUG_ASSERT(cs->state & MY_CS_BINSORT); - for ( ; dst < de && nweights; nweights--) + for (; dst < de && *nweights; (*nweights)--) { int res; if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0) @@ -4781,6 +4818,26 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, *dst++= (uchar) (wc & 0xFF); } } + return dst - dst0; +} + + +/* + Store sorting weights using 3 bytes per character. + This function is shared between utf8mb4_bin, utf16_bin, utf32_bin. +*/ +size_t +my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + my_wc_t UNINIT_VAR(wc); + uchar *dst0= dst; + uchar *de= dst + dstlen; + + dst+= my_strnxfrm_unicode_full_bin_internal(cs, dst, de, &nweights, + src, src + srclen); + DBUG_ASSERT(dst <= de); /* Safety */ if (flags & MY_STRXFRM_PAD_WITH_SPACE) { @@ -4795,7 +4852,7 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, } } } - + my_strxfrm_desc_and_reverse(dst0, dst, flags, 0); if (flags & MY_STRXFRM_PAD_TO_MAXLEN) @@ -4816,6 +4873,38 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, size_t +my_strnxfrm_unicode_full_nopad_bin(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + my_wc_t UNINIT_VAR(wc); + uchar *dst0= dst; + uchar *de= dst + dstlen; + + dst+= my_strnxfrm_unicode_full_bin_internal(cs, dst, de, &nweights, + src, src + srclen); + DBUG_ASSERT(dst <= de); /* Safety */ + + if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + size_t len= de - dst; + set_if_smaller(len, nweights * 3); + memset(dst, 0x00, len); + dst+= len; + } + + my_strxfrm_desc_and_reverse(dst0, dst, flags, 0); + + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de) + { + memset(dst, 0x00, de - dst); + dst= de; + } + return dst - dst0; +} + + +size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *cs, size_t len) { return ((len + 3) / cs->mbmaxlen) * 3; @@ -5092,33 +5181,40 @@ static size_t my_caseup_utf8(CHARSET_INFO *cs, char *src, size_t srclen, } -static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen, - ulong *nr1, ulong *nr2) +static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) { my_wc_t wc; int res; - const uchar *e=s+slen; + const uchar *e= s+slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; - /* - Remove end space. We have to do this to be able to compare - 'A ' and 'A' as identical - */ - while (e > s && e[-1] == ' ') - e--; - while ((s < e) && (res=my_utf8_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 ) { my_tosort_unicode(uni_plane, &wc, cs->state); MY_HASH_ADD_16(m1, m2, wc); - s+=res; + s+= res; } *nr1= m1; *nr2= m2; } +static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) +{ + const uchar *e= s+slen; + /* + Remove end space. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + while (e > s && e[-1] == ' ') + e--; + my_hash_sort_utf8_nopad(cs, s, e - s, nr1, nr2); +} + + static size_t my_caseup_str_utf8(CHARSET_INFO *cs, char *src) { my_wc_t wc; @@ -5387,6 +5483,15 @@ static inline int my_weight_mb3_utf8_general_ci(uchar b0, uchar b1, uchar b2) #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_nopad_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) my_weight_mb1_utf8_general_ci(x) +#define WEIGHT_MB2(x,y) my_weight_mb2_utf8_general_ci(x,y) +#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8_general_ci(x,y,z) +#include "strcoll.ic" + + static inline int my_weight_mb1_utf8_general_mysql500_ci(uchar b) { return (int) plane00_mysql500[b & 0xFF].sort; @@ -5426,6 +5531,14 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2) #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) (uchar) (x)) +#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y)) +#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z)) +#include "strcoll.ic" + /* TODO-10.2: join this with pad_max_char() in ctype-mb.c */ @@ -5505,6 +5618,39 @@ static MY_COLLATION_HANDLER my_collation_utf8_bin_handler = my_propagate_simple }; + +static MY_COLLATION_HANDLER my_collation_utf8_general_nopad_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf8_general_ci, + my_strnncollsp_utf8_general_nopad_ci, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_mb, + my_wildcmp_utf8, + my_strcasecmp_utf8, + my_instr_mb, + my_hash_sort_utf8_nopad, + my_propagate_complex +}; + + +static MY_COLLATION_HANDLER my_collation_utf8_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf8_bin, + my_strnncollsp_utf8_nopad_bin, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + MY_CHARSET_HANDLER my_charset_utf8_handler= { NULL, /* init */ @@ -5638,6 +5784,73 @@ struct charset_info_st my_charset_utf8_bin= &my_collation_utf8_bin_handler }; + +struct charset_info_st my_charset_utf8_general_nopad_ci= +{ + MY_NOPAD_ID(33),0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NOPAD, /* state */ + "utf8", /* cs name */ + "utf8_general_nopad_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + to_upper_utf8, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf8_handler, + &my_collation_utf8_general_nopad_ci_handler +}; + + +struct charset_info_st my_charset_utf8_nopad_bin= +{ + MY_NOPAD_ID(83),0,0,/* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_BINSORT|MY_CS_UNICODE|MY_CS_NOPAD, + "utf8", /* cs name */ + "utf8_nopad_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf8_handler, + &my_collation_utf8_nopad_bin_handler +}; + + #ifdef HAVE_UTF8_GENERAL_CS /* @@ -7427,7 +7640,7 @@ my_caseup_utf8mb4(CHARSET_INFO *cs, char *src, size_t srclen, static void -my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, +my_hash_sort_utf8mb4_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { my_wc_t wc; @@ -7436,13 +7649,6 @@ my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; - /* - Remove end space. We do this to be able to compare - 'A ' and 'A' as identical - */ - while (e > s && e[-1] == ' ') - e--; - while ((res= my_mb_wc_utf8mb4(cs, &wc, (uchar*) s, (uchar*) e)) > 0) { my_tosort_unicode(uni_plane, &wc, cs->state); @@ -7465,6 +7671,21 @@ my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, } +static void +my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *nr1, ulong *nr2) +{ + const uchar *e= s + slen; + /* + Remove end space. We do this to be able to compare + 'A ' and 'A' as identical + */ + while (e > s && e[-1] == ' ') + e--; + my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2); +} + + static size_t my_caseup_str_utf8mb4(CHARSET_INFO *cs, char *src) { @@ -7719,6 +7940,30 @@ size_t my_well_formed_len_utf8mb4(CHARSET_INFO *cs, #include "strcoll.ic" +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_general_nopad_ci +#define IS_MB4_CHAR(b0,b1,b2,b3) IS_UTF8MB4_STEP3(b0,b1,b2,b3) +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(b0) my_weight_mb1_utf8_general_ci(b0) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf8_general_ci(b0,b1) +#define WEIGHT_MB3(b0,b1,b2) my_weight_mb3_utf8_general_ci(b0,b1,b2) +/* + All non-BMP characters have the same weight. +*/ +#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER +#include "strcoll.ic" + + +#define DEFINE_STRNNCOLLSP_NOPAD +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_nopad_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(b0) ((int) (uchar) (b0)) +#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1)) +#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3)) +#include "strcoll.ic" + + static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler= { NULL, /* init */ @@ -7737,7 +7982,7 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler= static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = { - NULL, /* init */ + NULL, /* init */ my_strnncoll_utf8mb4_bin, my_strnncollsp_utf8mb4_bin, my_strnxfrm_unicode_full_bin, @@ -7751,6 +7996,38 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = }; +static MY_COLLATION_HANDLER my_collation_utf8mb4_general_nopad_ci_handler= +{ + NULL, /* init */ + my_strnncoll_utf8mb4_general_ci, + my_strnncollsp_utf8mb4_general_nopad_ci, + my_strnxfrm_unicode_nopad, + my_strnxfrmlen_unicode, + my_like_range_mb, + my_wildcmp_utf8mb4, + my_strcasecmp_utf8mb4, + my_instr_mb, + my_hash_sort_utf8mb4_nopad, + my_propagate_complex +}; + + +static MY_COLLATION_HANDLER my_collation_utf8mb4_nopad_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf8mb4_bin, + my_strnncollsp_utf8mb4_nopad_bin, + my_strnxfrm_unicode_full_nopad_bin, + my_strnxfrmlen_unicode_full_bin, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_nopad_bin, + my_propagate_simple +}; + + MY_CHARSET_HANDLER my_charset_utf8mb4_handler= { NULL, /* init */ @@ -7852,4 +8129,72 @@ struct charset_info_st my_charset_utf8mb4_bin= &my_collation_utf8mb4_bin_handler }; + +struct charset_info_st my_charset_utf8mb4_general_nopad_ci= +{ + MY_NOPAD_ID(45),0,0,/* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_UNICODE_SUPPLEMENT| + MY_CS_NOPAD, /* state */ + MY_UTF8MB4, /* cs name */ + MY_UTF8MB4_GENERAL_NOPAD_CI,/* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8mb4, /* ctype */ + to_lower_utf8mb4, /* to_lower */ + to_upper_utf8mb4, /* to_upper */ + to_upper_utf8mb4, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_utf8mb4_general_nopad_ci_handler +}; + + +struct charset_info_st my_charset_utf8mb4_nopad_bin= +{ + MY_NOPAD_ID(46),0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_STRNXFRM|MY_CS_UNICODE| + MY_CS_UNICODE_SUPPLEMENT|MY_CS_NOPAD, /* state */ + MY_UTF8MB4, /* cs name */ + MY_UTF8MB4_NOPAD_BIN, /* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8mb4, /* ctype */ + to_lower_utf8mb4, /* to_lower */ + to_upper_utf8mb4, /* to_upper */ + NULL, /* sort_order */ + NULL, /* uca */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + &my_unicase_default,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_utf8mb4_nopad_bin_handler +}; + #endif /* HAVE_CHARSET_utf8mb4 */ diff --git a/strings/ctype.c b/strings/ctype.c index 2764a327bb9..7d9789e48e2 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -618,6 +618,8 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len) i->cs.state|= MY_CS_BINSORT; else if (!strncmp("compiled",attr,len)) i->cs.state|= MY_CS_COMPILED; + else if (!strncmp("nopad",attr,len)) + i->cs.state|= MY_CS_NOPAD; break; case _CS_UPPERMAP: fill_uchar(i->to_upper,MY_CS_TO_UPPER_TABLE_SIZE,attr,len); diff --git a/strings/strcoll.ic b/strings/strcoll.ic index a9693b1f3c0..c647a5ef57e 100644 --- a/strings/strcoll.ic +++ b/strings/strcoll.ic @@ -202,8 +202,10 @@ MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)), } +#ifdef DEFINE_STRNNCOLLSP_NOPAD + /** - Compare two strings according to the collation, with PAD SPACE handling. + Compare two strings according to the collation, with NO PAD handling. @param cs - the character set and collation @param a - the left string @@ -212,7 +214,24 @@ MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)), @param b_length - the length of the right string @return - the comparison result */ +static int +MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length) +{ + return MY_FUNCTION_NAME(strnncoll)(cs, a, a_length, b, b_length, FALSE); +} +#else +/** + Compare two strings according to the collation, with PAD SPACE handling. + @param cs - the character set and collation + @param a - the left string + @param a_length - the length of the left string + @param b - the right string + @param b_length - the length of the right string + @return - the comparison result +*/ static int MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)), const uchar *a, size_t a_length, @@ -257,6 +276,7 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)), DBUG_ASSERT(0); return 0; } +#endif #ifdef DEFINE_STRNXFRM @@ -292,7 +312,12 @@ MY_FUNCTION_NAME(strnxfrm)(CHARSET_INFO *cs, else *dst++= sort_order ? sort_order[*src++] : *src++; } +#ifdef DEFINE_STRNNCOLLSP_NOPAD + return my_strxfrm_pad_desc_and_reverse_nopad(cs, d0, dst, de, + nweights, flags, 0); +#else return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); +#endif } #endif /* DEFINE_STRNXFRM */ @@ -310,3 +335,4 @@ MY_FUNCTION_NAME(strnxfrm)(CHARSET_INFO *cs, #undef WEIGHT_PAD_SPACE #undef WEIGHT_MB2_FRM #undef DEFINE_STRNXFRM +#undef DEFINE_STRNNCOLLSP_NOPAD diff --git a/strings/strings_def.h b/strings/strings_def.h index 36d3d2b2fe9..8bdb806d1d2 100644 --- a/strings/strings_def.h +++ b/strings/strings_def.h @@ -32,6 +32,8 @@ #define DBUG_ASSERT(A) assert(A) #endif +#define MY_NOPAD_ID(x) ((x)+0x400) + /* SPACE_INT is a word that contains only spaces */ #if SIZEOF_INT == 4 #define SPACE_INT 0x20202020 |