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

After executing "modify column", its flag has changed #11850

Closed
zimulala opened this issue Aug 23, 2019 · 3 comments
Closed

After executing "modify column", its flag has changed #11850

zimulala opened this issue Aug 23, 2019 · 3 comments
Labels
duplicate Issues or pull requests already exists. severity/moderate sig/sql-infra SIG: SQL Infra type/compatibility

Comments

@zimulala
Copy link
Contributor

zimulala commented Aug 23, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
CREATE TABLE `t` (
  `a` varchar(123) DEFAULT NULL,
  `d` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
 
tidb> select d from t;
Field   1:  `d`
Catalog:    `def`
Database:   `test`
Table:      `t`
Org_table:  `t`
Type:       DATETIME
Collation:  binary (63)
Length:     19
Max_length: 0
Decimals:   0
Flags:      NOT_NULL BINARY

alter table t modify column d datetime

select d from t;


2. What did you expect to see?
I hope that after executing "modify column", its flag is the same as before.

3. What did you see instead?

tidb> alter table t modify column d datetime;
Query OK, 0 rows affected (0.01 sec)
tidb> select d from t;
Field 1: d
Catalog: def
Database: test
Table: t
Org_table: t
Type: DATETIME
Collation: binary (63)
Length: 19
Max_length: 0
Decimals: 0
Flags:


4. What version of TiDB are you using (`tidb-server -V` or run `select tidb_version();` on TiDB)?
["Release Version"=v4.0.0-alpha-119-g0ff5b50c1-dirty]
["Git Commit Hash"=0ff5b50c1509bed279a2c2ba7acdb38519b38c9c]

@zimulala zimulala added type/bug The issue is confirmed as a bug. type/compatibility labels Aug 23, 2019
@zimulala
Copy link
Contributor Author

Related to #11800

@ghost
Copy link

ghost commented Jul 21, 2020

Confirming this issue still exists in master:

DROP TABLE IF EXISTS t;
CREATE TABLE `t` (
  `a` varchar(123) DEFAULT NULL,
  `d` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

select d from t;
alter table t modify column d datetime;
select d from t;


..

mysql> select d from t;
Field   1:  `d`
Catalog:    `def`
Database:   `test`
Table:      `t`
Org_table:  `t`
Type:       DATETIME
Collation:  binary (63)
Length:     19
Max_length: 0
Decimals:   0
Flags:      NOT_NULL BINARY 


0 rows in set (0.00 sec)

mysql> alter table t modify column d datetime;
Query OK, 0 rows affected (0.08 sec)

mysql> select d from t;
Field   1:  `d`
Catalog:    `def`
Database:   `test`
Table:      `t`
Org_table:  `t`
Type:       DATETIME
Collation:  binary (63)
Length:     19
Max_length: 0
Decimals:   0
Flags:      


0 rows in set (0.01 sec)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-807-g824df7675
Edition: Community
Git Commit Hash: 824df767559b8544af0cb71509135d322de1cd47
Git Branch: master
UTC Build Time: 2020-07-20 04:47:45
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

@jebter jebter added the sig/sql-infra SIG: SQL Infra label Nov 16, 2020
@wjhuang2016 wjhuang2016 added duplicate Issues or pull requests already exists. and removed type/bug The issue is confirmed as a bug. labels Nov 19, 2020
@wjhuang2016
Copy link
Member

Duplicate with #20720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues or pull requests already exists. severity/moderate sig/sql-infra SIG: SQL Infra type/compatibility
Projects
None yet
Development

No branches or pull requests

4 participants