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

In information_schema.columns table, timestamp column's column_default is inconsistent with MySQL #36027

Open
lmduean opened this issue Jul 7, 2022 · 6 comments
Labels

Comments

@lmduean
Copy link

@lmduean lmduean commented Jul 7, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table t ( b timestamp(3) NOT NULL DEFAULT '1970-01-01 08:00:01.000' COMMENT '');
Query OK, 0 rows affected (0.08 sec)

mysql> show create table t;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE t (
b timestamp(3) NOT NULL DEFAULT '1970-01-01 08:00:01.000'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select column_default from information_schema.columns where TABLE_NAME='t';
+-------------------------+
| column_default |
+-------------------------+
| 1970-01-01 00:00:01.000 |
+-------------------------+
1 row in set (0.03 sec)

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

In mysql:

mysql> create table t ( b timestamp(3) NOT NULL DEFAULT '1970-01-01 08:00:01.000' COMMENT '');
Query OK, 0 rows affected (0.00 sec)

mysql> show create table t;
+-------+-------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-------------------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE t (
b timestamp(3) NOT NULL DEFAULT '1970-01-01 08:00:01.000'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select column_default from information_schema.columns where TABLE_NAME='t';
+-------------------------+
| column_default |
+-------------------------+
| 1970-01-01 08:00:01.000 |
+-------------------------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

show create table's result and information_schema.columns's result are inconsistent!

4. What is your TiDB version? (Required)

mysql> mysql> select version();
+-----------------------------------------+
| version() |
+-----------------------------------------+
| 5.7.25-TiDB-v5.4.0-alpha-178-g02a8f0453 |
+-----------------------------------------+
1 row in set (0.00 sec)

@lmduean lmduean added the type/bug label Jul 7, 2022
@lmduean
Copy link
Author

@lmduean lmduean commented Jul 7, 2022

possible fix for v3.0.5 https://github.com/lmduean/tidb/pull/1/files

@Defined2014
Copy link
Contributor

@Defined2014 Defined2014 commented Jul 8, 2022

Thanks for your reply, you can get much information from this issue #35206

@lmduean
Copy link
Author

@lmduean lmduean commented Jul 8, 2022

Thanks for your reply, you can get much information from this issue #35206

so, we will not fix it?

@Defined2014
Copy link
Contributor

@Defined2014 Defined2014 commented Jul 8, 2022

Thanks for your reply, you can get much information from this issue #35206

so, we will not fix it?

I think it will be better if both information_schema.columns and show create table were related with timezone. If you have interests, you can open a PR to fix it. It looks like you already have a PR for v3.0.5.

@lmduean
Copy link
Author

@lmduean lmduean commented Jul 8, 2022

Thanks for your reply, you can get much information from this issue #35206

so, we will not fix it?

I think it will be better if both information_schema.columns and show create table were related with timezone. If you have interests, you can open a PR to fix it. It looks like you already have a PR for v3.0.5.

Thanks for your reply. I'm going to leave this to you to fix.

@xiongjiwei
Copy link
Member

@xiongjiwei xiongjiwei commented Jul 8, 2022

it is a mysql bug I think https://bugs.mysql.com/bug.php?id=107112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants