Commit a7510c70 authored by bar@mysql.com's avatar bar@mysql.com

Fix trailing spaces behaviour for binary collation.

parent 2496e85b
...@@ -79,6 +79,21 @@ SELECT 'a\t' < 'a'; ...@@ -79,6 +79,21 @@ SELECT 'a\t' < 'a';
SELECT 'a\t' < 'a '; SELECT 'a\t' < 'a ';
'a\t' < 'a ' 'a\t' < 'a '
1 1
SELECT 'a' = 'a ' collate utf8_bin;
'a' = 'a ' collate utf8_bin
1
SELECT 'a\0' < 'a' collate utf8_bin;
'a\0' < 'a' collate utf8_bin
1
SELECT 'a\0' < 'a ' collate utf8_bin;
'a\0' < 'a ' collate utf8_bin
1
SELECT 'a\t' < 'a' collate utf8_bin;
'a\t' < 'a' collate utf8_bin
1
SELECT 'a\t' < 'a ' collate utf8_bin;
'a\t' < 'a ' collate utf8_bin
1
CREATE TABLE t1 (a char(10) character set utf8 not null); CREATE TABLE t1 (a char(10) character set utf8 not null);
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a '); INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1; SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
......
...@@ -46,6 +46,15 @@ SELECT 'a\0' < 'a '; ...@@ -46,6 +46,15 @@ SELECT 'a\0' < 'a ';
SELECT 'a\t' < 'a'; SELECT 'a\t' < 'a';
SELECT 'a\t' < 'a '; SELECT 'a\t' < 'a ';
#
# The same for binary collation
#
SELECT 'a' = 'a ' collate utf8_bin;
SELECT 'a\0' < 'a' collate utf8_bin;
SELECT 'a\0' < 'a ' collate utf8_bin;
SELECT 'a\t' < 'a' collate utf8_bin;
SELECT 'a\t' < 'a ' collate utf8_bin;
CREATE TABLE t1 (a char(10) character set utf8 not null); CREATE TABLE t1 (a char(10) character set utf8 not null);
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a '); INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1; SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment