-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Insert data need to filter spaces #3660
Comments
Refer to: https://dev.mysql.com/doc/refman/5.7/en/char.html, the correct behavior of
the behavior of example 1: create table t(a char(10), b varchar(10), c tinytext, d text, e mediumtext, f longtext);
insert into t (a, b, c, d, e, f) values ("a ", "b ", "c ", "d ", "e ", "f ");
select length(a), length(b), length(c), length(d), length(e), length(f) from t;
+-----------+-----------+-----------+-----------+-----------+-----------+
| length(a) | length(b) | length(c) | length(d) | length(e) | length(f) |
+-----------+-----------+-----------+-----------+-----------+-----------+
| 1 | 2 | 2 | 2 | 2 | 2 |
+-----------+-----------+-----------+-----------+-----------+-----------+
select repeat(a, 2), repeat(b, 2), repeat(c, 2), repeat(d, 2), repeat(e, 2), repeat(f, 2) from t;
+--------------+--------------+--------------+--------------+--------------+--------------+
| repeat(a, 2) | repeat(b, 2) | repeat(c, 2) | repeat(d, 2) | repeat(e, 2) | repeat(f, 2) |
+--------------+--------------+--------------+--------------+--------------+--------------+
| aa | b b | c c | d d | e e | f f |
+--------------+--------------+--------------+--------------+--------------+--------------+ it seems like example 2: select a="a ", b="b ", c="c ", d="d ", e="e ", f="f " from t;
+---------+---------+---------+---------+---------+---------+
| a="a " | b="b " | c="c " | d="d " | e="e " | f="f " |
+---------+---------+---------+---------+---------+---------+
| 1 | 1 | 1 | 1 | 1 | 1 |
+---------+---------+---------+---------+---------+---------+ |
example 2 may relate to this:
|
leave out
|
Please answer these questions before submitting your issue. Thanks!
tidb-server -V
)?The text was updated successfully, but these errors were encountered: