Skip to content

Import into ... from select does not comply with the current SQL mode #58443

@gengliqi

Description

@gengliqi

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

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

mysql> create table s(x varchar(20));
Query OK, 0 rows affected (0.08 sec)

mysql> insert into s values('1e309abc');
Query OK, 1 row affected (0.01 sec)

mysql> alter table s set tiflash replica 1;
Query OK, 0 rows affected (0.11 sec)

mysql> set tidb_enforce_mpp=1;
Query OK, 0 rows affected (0.00 sec)

mysql> set sql_mode='';
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t select cast(x as double) from s;
Query OK, 1 row affected (0.09 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> truncate t;
Query OK, 0 rows affected (0.08 sec)

mysql> import into t from select cast(x as double) from s;
ERROR 1105 (HY000): other error for mpp stream: Code: 0, e.displayText() = DB::TiFlashException: Overflow error: Truncated incorrect DOUBLE value, e.what() = DB::TiFlashException,
mysql> explain import into t from select cast(x as double) from s;
+------------------------------+----------+--------------+---------------+-----------------------------------------+
| id                           | estRows  | task         | access object | operator info                           |
+------------------------------+----------+--------------+---------------+-----------------------------------------+
| ImportInto_2                 | N/A      | root         |               | N/A                                     |
| └─TableReader_14             | 10000.00 | root         |               | MppVersion: 2, data:ExchangeSender_13   |
|   └─ExchangeSender_13        | 10000.00 | mpp[tiflash] |               | ExchangeType: PassThrough               |
|     └─Projection_6           | 10000.00 | mpp[tiflash] |               | cast(test.s.x, double BINARY)->Column#4 |
|       └─TableFullScan_12     | 10000.00 | mpp[tiflash] | table:s       | keep order:false, stats:pseudo          |
+------------------------------+----------+--------------+---------------+-----------------------------------------+
5 rows in set (0.00 sec)

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

The sql import into ... from select should use non-strict sql mode and run successfully.

3. What did you see instead (Required)

Run failed

4. What is your TiDB version? (Required)

v8.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.severity/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