Skip to content
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

length result is wrong after modify column length #3644

Closed
zimulala opened this issue Jul 6, 2017 · 15 comments · Fixed by #24681
Closed

length result is wrong after modify column length #3644

zimulala opened this issue Jul 6, 2017 · 15 comments · Fixed by #24681
Labels
challenge-program help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@zimulala
Copy link
Contributor

zimulala commented Jul 6, 2017

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

@zimulala zimulala added the type/bug The issue is confirmed as a bug. label Jul 6, 2017
@zz-jason zz-jason self-assigned this Jul 8, 2017
@zz-jason
Copy link
Member

zz-jason commented Jul 8, 2017

related issue: #3660

@zimulala zimulala added the rc3.1 label Jul 13, 2017
zz-jason added a commit that referenced this issue Jul 13, 2017
@zz-jason zz-jason added the wontfix This issue will not be fixed. label Jul 14, 2017
@zimulala zimulala added future and removed rc3.1 wontfix This issue will not be fixed. labels Jul 14, 2017
@zz-jason zz-jason removed their assignment Mar 20, 2018
@zz-jason zz-jason added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. component/expression labels Mar 20, 2018
@morgo
Copy link
Contributor

morgo commented Mar 21, 2019

Confirming that I can still reproduce this:

mysql> select length(b) from t;
+-----------+
| length(b) |
+-----------+
|        22 |
|        33 |
+-----------+
2 rows in set (0.00 sec)

mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v3.0.0-beta-256-g961f0d235-dirty
Git Commit Hash: 961f0d23514c6ab033a76b2f64c20c87d46e7fdf
Git Branch: fix-idle-connections
UTC Build Time: 2019-03-21 02:33:13
GoVersion: go version go1.12.1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
1 row in set (0.00 sec)

@williamxiongwei
Copy link

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@williamxiongwei You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Sep 23, 2020
@ou-bing
Copy link
Contributor

ou-bing commented Dec 7, 2020

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@wjhuang2016
Copy link
Member

If column type change is not enabled, we can't append the padding 0x00 in the end. So I think we should forbid this alter table job.

@ou-bing
Copy link
Contributor

ou-bing commented Dec 11, 2020

If column type change is not enabled, we can't append the padding 0x00 in the end. So I think we should forbid this alter table job.

Do you think that changing the column type from binary (22) to binary (33) should not be supported?

@wjhuang2016
Copy link
Member

If column type change is not enabled, we can't append the padding 0x00 in the end. So I think we should forbid this alter table job.

Do you think that changing the column type from binary (22) to binary (33) should not be supported?

Yeah

@ti-challenge-bot
Copy link

@ou-bing You did not submit PR within 7 days, so give up automatically.

@jianzhiyao
Copy link
Contributor

If column type change is not enabled, we can't append the padding 0x00 in the end. So I think we should forbid this alter table job.

Do you think that changing the column type from binary (22) to binary (33) should not be supported?

Yeah

What's the final conclusion?

@wjhuang2016
Copy link
Member

@jianzhiyao We shouldn't allow this alter for now.

@LENSHOOD
Copy link
Contributor

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.

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet