summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/update.result19
-rw-r--r--mysql-test/t/update.test26
2 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 9e2bc52657a..b3c5760e2c9 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -434,3 +434,22 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 21
DROP TABLE t1;
+CREATE TABLE t1 (
+a INT(11),
+quux decimal( 31, 30 ),
+UNIQUE KEY bar (a),
+KEY quux (quux)
+);
+INSERT INTO
+t1 ( a, quux )
+VALUES
+( 1, 1 ),
+( 2, 0.1 );
+INSERT INTO t1( a )
+SELECT @newA := 1 + a FROM t1 WHERE quux <= 0.1;
+SELECT * FROM t1;
+a quux
+1 1.000000000000000000000000000000
+2 0.100000000000000000000000000000
+3 NULL
+DROP TABLE t1;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 3ce7ef72670..23ee75d61ea 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -342,3 +342,29 @@ UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
show status like '%Handler_read%';
DROP TABLE t1;
+
+#
+# Bug #24010: INSERT INTO ... SELECT fails on unique constraint with data it
+# doesn't select
+#
+CREATE TABLE t1 (
+
+ a INT(11),
+ quux decimal( 31, 30 ),
+
+ UNIQUE KEY bar (a),
+ KEY quux (quux)
+);
+
+INSERT INTO
+ t1 ( a, quux )
+VALUES
+ ( 1, 1 ),
+ ( 2, 0.1 );
+
+INSERT INTO t1( a )
+ SELECT @newA := 1 + a FROM t1 WHERE quux <= 0.1;
+
+SELECT * FROM t1;
+
+DROP TABLE t1;