Skip to content

bug: Update multiple values does not work with WHERE IN clause #781

@davidshiz

Description

@davidshiz

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

Update multiple values does not work

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   125 |  125 |
|  -125 | -125 |
| 99998 |  998 |
| 99999 |  999 |
+-------+------+
4 rows in set (0.00 sec)

mysql> UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (125, 99999);
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   125 |  125 |
|  -125 | -125 |
| 99998 |  998 |
| 99999 |  999 |
+-------+------+
4 rows in set (0.00 sec)

Expected behavior

the right answer is as follows:

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   125 |  125 |
|  -125 | -125 |
| 99998 |  998 |
| 99999 |  999 |
+-------+------+
4 rows in set (0.00 sec)

mysql> UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (125, 99999);
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from cs1;
+-------+------+
| d1    | d2   |
+-------+------+
|   888 |  777 |
|  -125 | -125 |
| 99998 |  998 |
|   888 |  777 |
+-------+------+
4 rows in set (0.01 sec)

How To Reproduce

CREATE TABLE cs1 (d1 DECIMAL(18), d2 DECIMAL(18));
INSERT INTO cs1 VALUES (125, 125);
INSERT INTO cs1 VALUES (-125, -125);
INSERT INTO cs1 values (99998, 998);
INSERT INTO cs1 values (99999, 999);
select * from cs1;
UPDATE cs1 SET d1=888, d2=777 WHERE d1 in (125, 99999);
select * from cs1;

Environment

root@ub01:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"

root@ub01:~# /stonedb57/install//bin/mysqld --version
/stonedb57/install//bin/mysqld  Ver 5.7.36-StoneDB 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: 86a7685dc
        Last commit time: Date:   Sat Oct 22 03:38:32 2022 +0800
        Build time: Date: Sat 22 Oct 2022 02:14:05 PM UTC

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

  • Yes, I will!

Metadata

Metadata

Labels

A-bugSomething isn't working

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions