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

Improper use of time zone when checking for default values ​in adding a column #9513

Closed
zimulala opened this issue Feb 28, 2019 · 0 comments · Fixed by #9578
Closed

Improper use of time zone when checking for default values ​in adding a column #9513

zimulala opened this issue Feb 28, 2019 · 0 comments · Fixed by #9578
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@zimulala
Copy link
Contributor

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 int);
ALTER TABLE t ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';
  1. What did you expect to see?

mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2019-02-28 21:09:30 |
+---------------------+
1 row in set (0.00 sec)

mysql> create table t(a int);
Query OK, 0 rows affected (0.02 sec)

mysql> ALTER TABLE t ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0
  1. What did you see instead?
tidb> select now();
+---------------------+
| now()               |
+---------------------+
| 2019-02-28 21:09:20 |
+---------------------+
1 row in set (0.00 sec)

tidb> create table t(a int);
Query OK, 0 rows affected (0.01 sec)

tidb>  ALTER TABLE t ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';
ERROR 1067 (42000): Invalid default value for 'ts'
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    Release Version: v3.0.0-beta-132-gddbf60f6d
    Git Commit Hash: ddbf60f
    Git Branch: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant