#At file:///export/home/z/mysql-6.0-runtime-bug35877/ based on revid:kostja@stripped
2781 Jon Olav Hauglid 2009-05-27
Bug #35877 Update .. WHERE with function, constraint violation, crash
Unable to reproduce crash with current version of mysql-6.0-runtime.
Test case for MyISAM/InnoDB based on the bug rapport added to sp.test.
modified:
mysql-test/r/sp_trans.result
mysql-test/t/sp_trans.test
=== modified file 'mysql-test/r/sp_trans.result'
--- a/mysql-test/r/sp_trans.result 2009-02-19 14:10:58 +0000
+++ b/mysql-test/r/sp_trans.result 2009-05-27 13:44:54 +0000
@@ -554,3 +554,33 @@ f1 bug13575(f1)
3 ccc
drop function bug13575|
drop table t3|
+#
+# End of 5.1 tests
+#
+#
+# Bug #35877 Update .. WHERE with function, constraint violation, crash
+#
+DROP TABLE IF EXISTS t1_aux|
+DROP TABLE IF EXISTS t1_not_null|
+DROP FUNCTION IF EXISTS f1_two_inserts|
+# MyISAM test
+CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)|
+CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)|
+INSERT INTO t1_aux VALUES (1,1)|
+CREATE FUNCTION f1_two_inserts() returns INTEGER
+BEGIN
+INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
+RETURN 1;
+END|
+UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
+ERROR 23000: Column 'f2' cannot be null
+# InnoDB test
+ALTER TABLE t1_not_null ENGINE = InnoDB|
+ALTER TABLE t1_aux ENGINE = InnoDB|
+UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
+ERROR 23000: Column 'f2' cannot be null
+DROP TABLE t1_aux, t1_not_null|
+DROP FUNCTION f1_two_inserts|
+#
+# End of 6.0 test
+#
=== modified file 'mysql-test/t/sp_trans.test'
--- a/mysql-test/t/sp_trans.test 2007-06-20 15:20:58 +0000
+++ b/mysql-test/t/sp_trans.test 2009-05-27 13:44:54 +0000
@@ -592,6 +592,47 @@ select distinct f1, bug13575(f1) from t3
drop function bug13575|
drop table t3|
+--echo #
+--echo # End of 5.1 tests
+--echo #
+
+--echo #
+--echo # Bug #35877 Update .. WHERE with function, constraint violation, crash
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1_aux|
+DROP TABLE IF EXISTS t1_not_null|
+DROP FUNCTION IF EXISTS f1_two_inserts|
+--enable_warnings
+
+-- echo # MyISAM test
+CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)|
+CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)|
+INSERT INTO t1_aux VALUES (1,1)|
+
+CREATE FUNCTION f1_two_inserts() returns INTEGER
+BEGIN
+ INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
+ RETURN 1;
+END|
+
+-- error ER_BAD_NULL_ERROR
+UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
+
+-- echo # InnoDB test
+ALTER TABLE t1_not_null ENGINE = InnoDB|
+ALTER TABLE t1_aux ENGINE = InnoDB|
+
+-- error ER_BAD_NULL_ERROR
+UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
+
+DROP TABLE t1_aux, t1_not_null|
+DROP FUNCTION f1_two_inserts|
+
+-- echo #
+-- echo # End of 6.0 test
+-- echo #
#
# BUG#NNNN: New bug synopsis
@@ -602,3 +643,4 @@ drop table t3|
#create procedure bugNNNN...
delimiter ;|
+
Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20090527134454-br98qivwfl0dn5vg.bundle