summaryrefslogtreecommitdiff
path: root/mysql-test/t/insert_select.test
diff options
context:
space:
mode:
authorMartin Hansson <mhansson@mysql.com>2009-05-04 14:45:36 +0200
committerMartin Hansson <mhansson@mysql.com>2009-05-04 14:45:36 +0200
commitfdd5a63fe6d1e81fe80c9d2e610041a3b0bc171c (patch)
tree54276802a0e835f3bb0b942c9f82b566159b2f26 /mysql-test/t/insert_select.test
parente7c4b2dfc77ae7cc8012f43b05991bdda044a459 (diff)
downloadmariadb-git-fdd5a63fe6d1e81fe80c9d2e610041a3b0bc171c.tar.gz
Bug#44306: Assertion fail on duplicate key error in
'INSERT ... SELECT' statements The code that produces result rows expected that a duplicate row error could not occur in INSERT ... SELECT statements with unfulfilled WHERE conditions. This may happen, however, if the SELECT list contains only aggregate functions. Fixed by checking if an error occured before trying to send EOF to the client. mysql-test/r/insert_select.result: Bug#44306: Test result mysql-test/t/insert_select.test: Bug#44306: Test case sql/sql_select.cc: Bug#44306: Fix
Diffstat (limited to 'mysql-test/t/insert_select.test')
-rw-r--r--mysql-test/t/insert_select.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 499db086877..f8023fcfc60 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -324,6 +324,16 @@ SELECT * FROM t2;
DROP TABLE t1, t2;
#
+# Bug#44306: Assertion fail on duplicate key error in 'INSERT ... SELECT'
+# statements
+#
+CREATE TABLE t1 ( a INT KEY, b INT );
+INSERT INTO t1 VALUES ( 0, 1 );
+--error ER_DUP_ENTRY
+INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
+DROP TABLE t1;
+
+#
# Bug #26207: inserts don't work with shortened index
#
SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';