#At file:///export/home/z/mysql-6.0-runtime-bug35877/ based on revid:jon.hauglid@stripped
2777 Jon Olav Hauglid 2009-05-15
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.result
mysql-test/t/sp.test
=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result 2009-04-30 10:14:32 +0000
+++ b/mysql-test/r/sp.result 2009-05-15 09:48:36 +0000
@@ -7055,6 +7055,35 @@ DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;
DROP TABLE t1;
+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
+DROP TABLE t1_aux, t1_not_null;
+DROP FUNCTION f1_two_inserts;
+# InnoDB test
+CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL) ENGINE = InnoDB;
+CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT) ENGINE = InnoDB;
+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
+DROP TABLE t1_aux, t1_not_null;
+DROP FUNCTION f1_two_inserts;
# ------------------------------------------------------------------
# -- End of 6.0 tests
# ------------------------------------------------------------------
=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test 2009-04-30 10:14:32 +0000
+++ b/mysql-test/t/sp.test 2009-05-15 09:48:36 +0000
@@ -8427,6 +8427,56 @@ DROP FUNCTION f3;
DROP FUNCTION f4;
DROP TABLE t1;
+#
+# Bug#35877 Update .. WHERE with function, constraint violation, crash
+#
+
+--source include/have_innodb.inc
+
+--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);
+
+delimiter //;
+CREATE FUNCTION f1_two_inserts() returns INTEGER
+BEGIN
+ INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
+ RETURN 1;
+END//
+delimiter ;//
+
+-- 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 # InnoDB test
+CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL) ENGINE = InnoDB;
+CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT) ENGINE = InnoDB;
+INSERT INTO t1_aux VALUES (1,1);
+
+delimiter //;
+CREATE FUNCTION f1_two_inserts() returns INTEGER
+BEGIN
+ INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
+ RETURN 1;
+END//
+delimiter ;//
+
+-- 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 tests
--echo # ------------------------------------------------------------------
Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20090515094836-xolhvfb2e26981yx.bundle
| Thread |
|---|
| • bzr commit into mysql-6.0-runtime branch (jon.hauglid:2777) Bug#35877 | Jon Olav Hauglid | 15 May |