tidb icon indicating copy to clipboard operation
tidb copied to clipboard

Error execute insert statement with date type using the prepare api

Open harry1129 opened this issue 1 year ago • 2 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t4 (a date) ; prepare st1 from "insert into t4(a) select dt from (select ? as dt from dual union all select sysdate() ) a" ; set @t='2022-01-01 00:00:00.000000' ; execute st1 using @t ;

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

Statement executed without error.

3. What did you see instead (Required)

mysql> use test; Database changed mysql> create table t4 (a date) ; Query OK, 0 rows affected (0.07 sec)

mysql> prepare st1 from "insert into t4(a) select dt from (select ? as dt from dual union all select sysdate() ) a" ; Query OK, 0 rows affected (0.00 sec)

mysql> set @t='2022-01-01 00:00:00.000000' ; Query OK, 0 rows affected (0.00 sec)

mysql> execute st1 using @t ; ERROR 1406 (22001): Data Too Long, field len 19, data len 26

4. What is your TiDB version? (Required)

mysql> select tidb_version()\G *************************** 1. row *************************** tidb_version(): Release Version: v6.1.1 Edition: Community Git Commit Hash: 5263a0abda61f102122735049fd0dfadc7b7f8b2 Git Branch: heads/refs/tags/v6.1.1 UTC Build Time: 2022-08-25 10:42:41 GoVersion: go1.18.5 Race Enabled: false TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 Check Table Before Drop: false 1 row in set (0.00 sec)

harry1129 avatar Sep 16 '22 10:09 harry1129

@fzzf678 Could you take a look at this issue?

qw4990 avatar Sep 22 '22 03:09 qw4990

/assign

fzzf678 avatar Sep 22 '22 07:09 fzzf678

各位老师麻烦问下,这个问题在哪个版本修复,有计划吗?

guanguanglei avatar Sep 27 '22 06:09 guanguanglei

各位老师麻烦问下,这个问题在哪个版本修复,有计划吗?

We'll fix it next week.

qw4990 avatar Oct 08 '22 11:10 qw4990