Below is the list of changes that have just been committed into a local
5.0 repository of martin. When martin does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-02-22 14:11:01+01:00, mhansson@stripped +2 -0
Bug #24010: INSERT INTO ... SELECT fails on unique constraint with data
it doesn't select.
This bug was fixed along with bug #16861: User defined variable can
have a wrong value if a tmp table was used.
There the fix consisted of Item_func_set_user_var overloading the method
Item::save_in_field. Consider the query from the test case:
INSERT INTO foo( bar, baz )
SELECT
bar,
@newBaz := 1 + baz
FROM
foo
WHERE
quux <= 0.1;
Here the assignment expression '@newBaz := 1 + baz' is represented by an
Item_func_set_user_var. Its member method save_in_field, which writes the
value of this assignment into the result field, writes the val_xxx() value,
which is not updated at this point. In the fix introduced by the patch,
the save_in_field method reads the actual variable value instead.
See also comment for
ChangeSet@stripped, 2007-01-09 23:24:56+03:00, evgen@stripped +4 -0
and comment for
Item_func_set_user_var::save_in_field (item_func.cc)
mysql-test/r/update.result@stripped, 2007-02-22 14:11:00+01:00, mhansson@stripped +19
-0
BUG#24010
The correct, and expected, result
mysql-test/t/update.test@stripped, 2007-02-22 14:11:00+01:00, mhansson@stripped +26
-0
BUG#24010
The test case for this bug. When the bug is active, the INSERT ... SELECT
statement will try to insert the values <1, 2> which gives an error
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mhansson
# Host: linux-st28.site
# Root: /home/martin/mysql/src/5.0o-bug24010
--- 1.31/mysql-test/r/update.result 2007-02-03 00:22:08 +01:00
+++ 1.32/mysql-test/r/update.result 2007-02-22 14:11:00 +01:00
@@ -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;
--- 1.29/mysql-test/t/update.test 2007-02-03 00:22:08 +01:00
+++ 1.30/mysql-test/t/update.test 2007-02-22 14:11:00 +01:00
@@ -342,3 +342,29 @@ UPDATE t1 SET user_id=null WHERE request
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;
| Thread |
|---|
| • bk commit into 5.0 tree (mhansson:1.2410) BUG#24010 | mhansson | 22 Feb |