Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6.11
Description
On table with single unique index:
CREATE TABLE `test` ( |
`id` int(11) NOT NULL, |
`value` int(11) NOT NULL, |
UNIQUE KEY `id` (`id`) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci |
ROW_COUNT() returns allways 1, even for duplicate rows:
REPLACE INTO test VALUES (1,1); SELECT ROW_COUNT(); REPLACE INTO test VALUES (1,1); SELECT ROW_COUNT(); |
Query OK, 1 row affected (0.000 sec)
|
|
+-------------+ |
| ROW_COUNT() |
|
+-------------+ |
| 1 |
|
+-------------+ |
1 row in set (0.000 sec) |
|
Query OK, 1 row affected (0.000 sec)
|
|
+-------------+ |
| ROW_COUNT() |
|
+-------------+ |
| 1 |
|
+-------------+ |
1 row in set (0.000 sec) |
On table with multiple indexes:
CREATE TABLE `test` ( |
`id` int(11) NOT NULL, |
`value` int(11) NOT NULL, |
UNIQUE KEY `id` (`id`), |
UNIQUE KEY `value` (`value`) |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci |
ROW_COUNT() returns correct result according to documentation (1 and then 2):
REPLACE INTO test VALUES (1,1); SELECT ROW_COUNT(); REPLACE INTO test VALUES (1,1); SELECT ROW_COUNT(); |
Query OK, 1 row affected (0.000 sec)
|
|
+-------------+ |
| ROW_COUNT() |
|
+-------------+ |
| 1 |
|
+-------------+ |
1 row in set (0.000 sec) |
|
Query OK, 2 rows affected (0.000 sec) |
|
+-------------+ |
| ROW_COUNT() |
|
+-------------+ |
| 2 |
|
+-------------+ |
1 row in set (0.000 sec) |