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

ddl: primary column flag changed after alter table statement #21465

Closed
cfzjywxk opened this issue Dec 3, 2020 · 2 comments · Fixed by #21468
Closed

ddl: primary column flag changed after alter table statement #21465

cfzjywxk opened this issue Dec 3, 2020 · 2 comments · Fixed by #21468
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@cfzjywxk
Copy link
Contributor

cfzjywxk commented Dec 3, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1; 
create table t1(c1 int key, c2 int);

mysql> select c1 from t1;
Field   1:  `c1`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       LONG
Collation:  binary (63)
Length:     11
Max_length: 0
Decimals:   0
Flags:      NOT_NULL PRI_KEY NUM 

Do the alter table

ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL;

Check the flags again

mysql> select c1 from t1;
Field   1:  `c1`
Catalog:    `def`
Database:   `test`
Table:      `t1`
Org_table:  `t1`
Type:       LONG
Collation:  binary (63)
Length:     11
Max_length: 0
Decimals:   0
Flags:      NOT_NULL PRI_KEY NO_DEFAULT_VALUE NUM

There will be a new NO_DEFAULT_VALUE NUM on the primary key column but we changed nothing.

2. What did you expect to see? (Required)

A new flag NO_DEFAULT_VALUE is added onto the new column.

3. What did you see instead (Required)

Flags are the same after alter table for the primary key column.

4. What is your TiDB version? (Required)

release-4.0 2862cd7

@cfzjywxk cfzjywxk added type/question The issue belongs to a question. type/bug The issue is confirmed as a bug. severity/major sig/sql-infra SIG: SQL Infra and removed type/question The issue belongs to a question. labels Dec 3, 2020
@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Dec 3, 2020

@bb7133 @wjhuang2016 PTAL

@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
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants