Skip to content

cast string as datetime with time zone results in loss of precision #8754

@SeaRise

Description

@SeaRise

Bug Report

Please answer these questions before submitting your issue. Thanks!
related to pingcap/tidb#49555

1. Minimal reproduce step (Required)

use test;
drop table if exists t;
create table t(a varchar(50));
alter table test.t set tiflash replica 1;
insert into t values ('2020-01-01 12:00:00.123456 +0600 PST');
insert into t values ('2020-01-01 12:00:00.123456 -0600 PST');
set tidb_allow_mpp=1;set tidb_enforce_mpp=1; set tidb_isolation_read_engines='tiflash';
select cast(a as datetime(3)) from t;

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

+-------------------------+
| cast(a as datetime(3))  |
+-------------------------+
| 2020-01-01 12:00:00.123 |
| 2020-01-01 12:00:00.123 |
+-------------------------+

3. What did you see instead (Required)

+-------------------------+
| cast(a as datetime(3))  |
+-------------------------+
| 2020-01-01 12:00:00.000 |
| 2020-01-01 12:00:00.000 |
+-------------------------+

4. What is your TiFlash version? (Required)

v8.0.0-alpha-126-gc0476a0

Metadata

Metadata

Assignees

Labels

affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.component/computeimpact/wrong-resultseverity/majortype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions