Commit dcc5b43b authored by Martin Hansson's avatar Martin Hansson

Bug#50545: Single table UPDATE IGNORE crashes on

join view in sql_safe_updates mode. 

This bug was unexpectedly fixed along with bug 
number 49534. This patch contains only the test
case.
parent 6b69a145
...@@ -514,3 +514,16 @@ ALTER TABLE t2 COMMENT = 'ABC'; ...@@ -514,3 +514,16 @@ ALTER TABLE t2 COMMENT = 'ABC';
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9; UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
ALTER TABLE t2 COMMENT = 'DEF'; ALTER TABLE t2 COMMENT = 'DEF';
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug#50545: Single table UPDATE IGNORE crashes on join view in
# sql_safe_updates mode.
#
CREATE TABLE t1 ( a INT, KEY( a ) );
INSERT INTO t1 VALUES (0), (1);
CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
SET SESSION sql_safe_updates = 1;
UPDATE IGNORE v1 SET a = 1;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
SET SESSION sql_safe_updates = DEFAULT;
DROP TABLE t1;
DROP VIEW v1;
...@@ -467,3 +467,19 @@ UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9; ...@@ -467,3 +467,19 @@ UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
ALTER TABLE t2 COMMENT = 'DEF'; ALTER TABLE t2 COMMENT = 'DEF';
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # Bug#50545: Single table UPDATE IGNORE crashes on join view in
--echo # sql_safe_updates mode.
--echo #
CREATE TABLE t1 ( a INT, KEY( a ) );
INSERT INTO t1 VALUES (0), (1);
CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
SET SESSION sql_safe_updates = 1;
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE IGNORE v1 SET a = 1;
SET SESSION sql_safe_updates = DEFAULT;
DROP TABLE t1;
DROP VIEW v1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment