dble icon indicating copy to clipboard operation
dble copied to clipboard

[select ... from ... where ...order by convert( col using gbk); ] cannot in right order when col's value is chinese character

Open yexiaoli88 opened this issue 6 years ago • 0 comments

  • dble version:5.6.29-dble-9.9.9.9-884fc6b612d64cc22101226536f8fd1d24580857-20190221031624

  • preconditions *:

create table sharding_four(id int, c varchar(10)) charset utf8mb4;
insert into sharding_four values(1, 'a'),(2, '吃'),(3,'啊'),(4,'吧'),(1004,'吃');

schema.xml

<table dataNode="dn1,dn2,dn3,dn4" name="sharding_four" rule="hash-four" />
  • steps: step1. execute sqls indble:
mysql> select * from sharding_four where id in (1,2,3,4,1004) order by convert(c using gbk);
+------+------+
| id   | c    |
+------+------+
|    1 | a    |
|    2 | 吃   |
|    4 | 吧   |
| 1004 | 吃   |
|    3 | 啊   |

step2.execute sql in mysql:

mysql> select * from sharding_four where id in (1,2,3,4,1004) order by convert(c using gbk);
+------+------+
| id   | c    |
+------+------+
|    1 | a    |
|    3 | 啊   |
|    4 | 吧   |
|    2 | 吃   |
| 1004 | 吃   |
  • expect result:
    1.result of step1 should be the same as step2
  • real result:
    1.result of step1 was not in right order
  • supplements:
    1.

/label ~BUG

yexiaoli88 avatar Feb 21 '19 07:02 yexiaoli88