diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-10-18 20:30:04 +0530 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-10-26 17:29:40 +0200 |
commit | 92f7d008ab5da38e443cd1801be0cf147267d8cd (patch) | |
tree | a8770a1bf78605402399153d52d63abad81e1652 /mysql-test | |
parent | e13dc7d0d0820973684753cdb5cf674c4595f47b (diff) | |
download | mariadb-git-bb-10.7-row_number.tar.gz |
MDEV-26844: DELETE returns ROW_NUMBER=1 for every row uponbb-10.7-row_number
ER_TRUNCATED_WRONG_VALUE
Part 1: Fix for DELETE without ORDER BY
Analysis: m_current_row_for_warning doesn't increment and assumes default
value which is then used by ROW_NUMBER.
Fix: Increment m_current_row_for_warning for each processed row.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/main/get_diagnostics.result | 28 | ||||
-rw-r--r-- | mysql-test/main/get_diagnostics.test | 20 |
2 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/main/get_diagnostics.result b/mysql-test/main/get_diagnostics.result index a884ebe3fe0..2e749fa21d7 100644 --- a/mysql-test/main/get_diagnostics.result +++ b/mysql-test/main/get_diagnostics.result @@ -1783,3 +1783,31 @@ SELECT @n; @n 4 DROP TABLE t1; +# +# MDEV-26844: DELETE returns ROW_NUMBER=1 for every row upon +# ER_TRUNCATED_WRONG_VALUE +# +# without ORDER BY +CREATE TABLE t (a VARCHAR(8)); +INSERT INTO t VALUES ('val1'),('val2'),('100'),('val4'); +SELECT * FROM t; +a +val1 +val2 +100 +val4 +DELETE FROM t WHERE a = 100; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'val1' +Warning 1292 Truncated incorrect DOUBLE value: 'val2' +Warning 1292 Truncated incorrect DOUBLE value: 'val4' +SHOW WARNINGS; +Level Code Message +Warning 1292 Truncated incorrect DOUBLE value: 'val1' +Warning 1292 Truncated incorrect DOUBLE value: 'val2' +Warning 1292 Truncated incorrect DOUBLE value: 'val4' +GET DIAGNOSTICS CONDITION 3 @n = ROW_NUMBER; +SELECT @n; +@n +4 +DROP TABLE t; diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test index a1779f3c0ab..e8d81dca1e6 100644 --- a/mysql-test/main/get_diagnostics.test +++ b/mysql-test/main/get_diagnostics.test @@ -1667,3 +1667,23 @@ GET DIAGNOSTICS CONDITION 2 @n= ROW_NUMBER; SELECT @n; DROP TABLE t1; + +--echo # +--echo # MDEV-26844: DELETE returns ROW_NUMBER=1 for every row upon +--echo # ER_TRUNCATED_WRONG_VALUE +--echo # + +--echo # without ORDER BY + +CREATE TABLE t (a VARCHAR(8)); + +INSERT INTO t VALUES ('val1'),('val2'),('100'),('val4'); +SELECT * FROM t; + +DELETE FROM t WHERE a = 100; +SHOW WARNINGS; + +GET DIAGNOSTICS CONDITION 3 @n = ROW_NUMBER; +SELECT @n; + +DROP TABLE t; |