tidb: `length` result is wrong after modify column length

Description

Please answer these questions before submitting your issue. Thanks!

  1. 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;
  1. What did you expect to see?
+-----------+
| length(b) |
+-----------+
|        33 |
|        33 |
+-----------+
  1. What did you see instead?
+-----------+
| length(b) |
+-----------+
|        22 |
|        33 |
+-----------+
  1. What version of TiDB are you using (tidb-server -V)?

SIG slack channel

#sig-exec

Score

  • 300

Mentor

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

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 when tidb_enable_change_column_type = 1.