#
# 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
#
