From e0fbc5d248e4d35920553417f13701484b20f622 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Thu, 18 Feb 2010 17:02:17 +0000 Subject: Bug#48525: trigger changes "Column 'id' cannot be null" behaviour CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL; UPDATE...SET...NULL on NOT NULL fields behaved differently after a trigger. Now distinguishes between IGNORE and ERROR_FOR_NULL and save/restores check-field options. mysql-test/r/trigger.result: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. mysql-test/t/trigger.test: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. sql/field_conv.cc: CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL. Distinguish between the two. sql/sp_head.cc: raise error as needed sql/sql_class.cc: Save and restore check-fields options. sql/sql_class.h: Make room so we can save check-fields options. sql/sql_insert.cc: raise error as needed --- mysql-test/r/trigger.result | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/r/trigger.result') diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 4476735735c..6255e5fcceb 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2087,4 +2087,21 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist SELECT * FROM t2; a b DROP TABLE t1, t2; +CREATE TABLE t1 (id INT NOT NULL); +CREATE TABLE t2 (id INT NOT NULL); +INSERT t1 VALUES (1),(2),(3); +UPDATE t1 SET id=NULL; +Warnings: +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW +INSERT INTO t2 VALUES (3); +UPDATE t1 SET id=NULL; +Warnings: +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +DROP TRIGGER t1_bu; +DROP TABLE t1,t2; End of 5.1 tests. -- cgit v1.2.1 From dad7b3c55e2f4da0d3b03e561bea20153b03a720 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 22 Feb 2010 16:58:56 +0000 Subject: revert 48525 --- mysql-test/r/trigger.result | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'mysql-test/r/trigger.result') diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 6255e5fcceb..4476735735c 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2087,21 +2087,4 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist SELECT * FROM t2; a b DROP TABLE t1, t2; -CREATE TABLE t1 (id INT NOT NULL); -CREATE TABLE t2 (id INT NOT NULL); -INSERT t1 VALUES (1),(2),(3); -UPDATE t1 SET id=NULL; -Warnings: -Warning 1048 Column 'id' cannot be null -Warning 1048 Column 'id' cannot be null -Warning 1048 Column 'id' cannot be null -CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW -INSERT INTO t2 VALUES (3); -UPDATE t1 SET id=NULL; -Warnings: -Warning 1048 Column 'id' cannot be null -Warning 1048 Column 'id' cannot be null -Warning 1048 Column 'id' cannot be null -DROP TRIGGER t1_bu; -DROP TABLE t1,t2; End of 5.1 tests. -- cgit v1.2.1 From 02ac873ccfb5deb46533aefd35640a95f51d1c67 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 9 Mar 2010 18:55:08 -0300 Subject: Bug#51650: crash with user variables and triggers The problem was that bits of the destructive equality propagation optimization weren't being undone after the execution of a stored program. Modifications to the parse tree that are based on transient properties must be undone to enable the re-execution of stored programs. The solution is to cleanup any references to predicates generated by the equality propagation during the execution of a stored program. mysql-test/r/trigger.result: Add test case result for Bug#51650. mysql-test/t/trigger.test: Add test case for Bug#51650. sql/item.cc: Remove reference to a equality predicate. --- mysql-test/r/trigger.result | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/r/trigger.result') diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 4476735735c..5758f5b93d7 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2087,4 +2087,28 @@ ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist SELECT * FROM t2; a b DROP TABLE t1, t2; +# +# Bug#51650 crash with user variables and triggers +# +DROP TRIGGER IF EXISTS trg1; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (b VARCHAR(50) NOT NULL); +CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT ''); +CREATE TRIGGER trg1 AFTER INSERT ON t2 +FOR EACH ROW BEGIN +SELECT 1 FROM t1 c WHERE +(@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo; +END// +SET @bug51650 = 1; +INSERT IGNORE INTO t2 VALUES(); +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +INSERT IGNORE INTO t1 SET b = '777'; +INSERT IGNORE INTO t2 SET a = '111'; +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +SET @bug51650 = 1; +INSERT IGNORE INTO t2 SET a = '777'; +DROP TRIGGER trg1; +DROP TABLE t1, t2; End of 5.1 tests. -- cgit v1.2.1 From 28e95ba535e175dc696fe7a739736ae9bf2a2b36 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 29 Mar 2010 03:32:30 +0100 Subject: Bug#48525: trigger changes "Column 'id' cannot be null" behaviour CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL; UPDATE...SET...NULL on NOT NULL fields behaved differently after a trigger. Now distinguishes between IGNORE and ERROR_FOR_NULL and save/restores check-field options. mysql-test/r/trigger.result: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. mysql-test/t/trigger.test: Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently when run after a trigger. sql/field_conv.cc: CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL. Distinguish between the two. sql/sp_head.cc: Raise error as needed. sql/sql_class.cc: Save and restore check-fields options. sql/sql_class.h: Make room so we can save check-fields options. sql/sql_insert.cc: Raise error as needed. --- mysql-test/r/trigger.result | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/r/trigger.result') diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 5758f5b93d7..3446babbb52 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2111,4 +2111,21 @@ SET @bug51650 = 1; INSERT IGNORE INTO t2 SET a = '777'; DROP TRIGGER trg1; DROP TABLE t1, t2; +CREATE TABLE t1 (id INT NOT NULL); +CREATE TABLE t2 (id INT NOT NULL); +INSERT t1 VALUES (1),(2),(3); +UPDATE t1 SET id=NULL; +Warnings: +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW +INSERT INTO t2 VALUES (3); +UPDATE t1 SET id=NULL; +Warnings: +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +Warning 1048 Column 'id' cannot be null +DROP TRIGGER t1_bu; +DROP TABLE t1,t2; End of 5.1 tests. -- cgit v1.2.1