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

Load the imported data into the database, timestamp column, TiDB and MySQL behavior inconsistent #10504

Closed
together-wang opened this issue May 16, 2019 · 0 comments · Fixed by #11093
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@together-wang
Copy link

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.

$ cat a.csv
2019-02-01 00:00:00

load data local infile "/data1/a.csv" into table test_table1;

Table structure:
MySQL [lianxi]> show create table test_table1 \G
*************************** 1. row ***************************
Table: test_table1
Create Table: CREATE TABLE test_table1 (
stime datetime DEFAULT NULL COMMENT '时间',
id bigint(20) DEFAULT NULL COMMENT '编号',
zone varchar(100) DEFAULT NULL COMMENT '地区',
cnt bigint(20) DEFAULT NULL COMMENT '次数',
updated timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
updated1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
updated2 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY idx_id (id),
KEY idx_zone (zone)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='测试表';

  1. What did you expect to see?

MySQL [lianxi]> select * from test_table1 where stime='2019-02-01 00:00:00';
+---------------------+------+------+------+---------+---------------------+---------------------+
| stime | id | zone | cnt | updated | updated1 | updated2 |
+---------------------+------+------+------+---------+---------------------+---------------------+
| 2019-02-01 00:00:00 | NULL | NULL | NULL | NULL | 2019-05-15 19:41:02 | 2019-05-15 19:41:02 |
+---------------------+------+------+------+---------+---------------------+---------------------+

  1. What did you see instead?

MySQL [test]> select * from test_table1 where stime='2019-02-01 00:00:00';
+---------------------+------+------+------+---------+---------------------+---------------------+
| stime | id | zone | cnt | updated | updated1 | updated2 |
+---------------------+------+------+------+---------+---------------------+---------------------+
| 2019-02-01 00:00:00 | NULL | NULL | NULL | NULL | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
+---------------------+------+------+------+---------+---------------------+---------------------+

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

Release Version: v2.1.8
Git Commit Hash: 9a2d2da
Git Branch: HEAD
UTC Build Time: 2019-04-12 07:48:47
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false

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.

3 participants