tidb: `length` result is wrong after modify column length
Description
Please answer these questions before submitting your issue. Thanks!
- What did you do?
create table t(a int, b binary(22));
insert into t set b='test';
alter table t modify b binary(33);
insert into t set b='test1';
select length(b) from t;
- What did you expect to see?
+-----------+
| length(b) |
+-----------+
| 33 |
| 33 |
+-----------+
- What did you see instead?
+-----------+
| length(b) |
+-----------+
| 22 |
| 33 |
+-----------+
- What version of TiDB are you using (
tidb-server -V
)?
SIG slack channel
Score
- 300
Mentor
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (10 by maintainers)
Commits related to this issue
- [fix #3644] length(binary(m)) should return 'm' instead of the concrete string length — committed to pingcap/tidb by zz-jason 7 years ago
- expression: length(binary(m)) should return 'm' instead of the concrete string length Fixes #3644 — committed to miraclesu/tidb by miraclesu 5 years ago
- expression: length(binary(m)) should return 'm' instead of the concrete string length Fixes #3644 — committed to miraclesu/tidb by miraclesu 5 years ago
Let me do this?
The issue could be easy to fix since modify column feature almost finished.
We can just forbid alter binary to binary when
tidb_enable_change_column_type = 0
and do the column change whentidb_enable_change_column_type = 1
.