-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected eliminated conditions in the connection with utf8mb4 charset #53730
Comments
Mysql behaviorThe utf8, UTF8MB3, UTF8MB4 have the same behavior.
|
What behavior of uft8/uft8mb4?The trailing spaces will be ignore when compared with other string. But, it doesn't mean the tailing spaces should be ignore in the length function. The length of "a " is 2 not 1.
From mysql For PAD SPACE collations, trailing spaces are insignificant in comparisons; strings are compared without regard to trailing spaces. NO PAD collations treat trailing spaces as significant in comparisons, like any other character. The differing behaviors can be demonstrated using the two utf8mb4 binary collations, one of which is PAD SPACE, the other of which is NO PAD. The example also shows how to use the INFORMATION_SCHEMA COLLATIONS table to determine the pad attribute for collations.
|
Constant propagatewhere name='a' and length(name) = 1 The predicate name='a' couldn't propagate to length('a'). Because the collation of utfxxx_bin ignore the tailling space, while length function shouldn't ignore it. |
The constant propagate bug |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create table t (id int primary key, name varchar(20));
insert into t values(1, 'a'), (2, 'a ');
select * from t where name='a' and length(name)=1;
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
v6.5.6
The text was updated successfully, but these errors were encountered: