summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2021-12-24 14:00:47 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2022-01-03 18:14:59 +0530
commit452c9a4d72c18a19136a91f4d59ee60eedd486be (patch)
tree2a824206a75eda98b8d2d70f67e3f7611bc420eb /mysql-test/r
parent5d57e04b27d0e69081b63b9e382cc3d9dc4480c0 (diff)
downloadmariadb-git-452c9a4d72c18a19136a91f4d59ee60eedd486be.tar.gz
MDEV-26698: Incorrect row number upon INSERT .. SELECT from the samebb-10.2-MDEV-26698
table: rows are counted twice Analysis: When the table we are trying to insert into and the SELECT table are same for INSERT ... SELECT, rows from the SELECT table are copied into internal temporary table and then to the INSERT table. We only want to count the rows when we start inserting into the table. Fix: Reset the counter to 1 before starting to copy from internal temporary table to select table and then increment the counter.
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/insert_select.result19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index b86c859d0bd..26076eec068 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -865,3 +865,22 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
End of 5.5 tests
+#
+# Beginning of 10.2 test
+#
+# MDEV-26698: Incorrect row number upon INSERT .. SELECT from the same
+# table: rows are counted twice
+#
+CREATE TABLE t1(a TINYINT);
+INSERT INTO t1 VALUES (1), (100);
+INSERT INTO t1 SELECT a*2 FROM t1;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 2
+TRUNCATE TABLE t1;
+# using ORDER BY
+INSERT INTO t1 VALUES(1), (2), (100), (3);
+INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 4
+DROP TABLE t1;
+# End of 10.2 test