stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
862 stars 139 forks source link

bug: Paste SQL in batches to the terminal for execution, return error #1399

Open davidshiz opened 1 year ago

davidshiz commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

Batch paste execution:

mysql> CREATE TABLE t1 (a INT);
Query OK, 0 rows affected (0.02 sec)

mysql> CREATE TABLE t2 (a DECIMAL(10,2));
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO t2 VALUES (10.1),(10.9);
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> INSERT INTO t1 SELECT a FROM t2;
Query OK, 2 rows affected, 1 warning (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 1

mysql> SELECT * FROM t1;
+------+
| a    |
+------+
|    3 |
|    3 |
+------+
2 rows in set (0.00 sec)

Expected behavior

mysql> SELECT * FROM t1;
+------+
| a    |
+------+
|   10 |
|   11 |
+------+
2 rows in set (0.00 sec)

How To Reproduce

CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a DECIMAL(10,2));
INSERT INTO t2 VALUES (10.1),(10.9);
INSERT INTO t1 SELECT a FROM t2;
SELECT * FROM t1;

Environment

root@ub01:~# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB-v1.0.3 for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: f5cd1f9bb
        Last commit time: Date:   Tue Mar 7 10:50:50 2023 +0800
        Build time: Date: Fri Mar 10 20:14:28 CST 2023

Are you interested in submitting a PR to solve the problem?

davidshiz commented 1 year ago

can refer to #1172, but this issue result is abnormal

konghaiya commented 1 year ago

Other types are normal, only decimal types have this problem