Bug #12168 'DECLARE CONTINUE HANDLER FOR NOT FOUND ...' in conditional handled incorrectly
| Submitted: | 26 Jul 2005 1:03 | Modified: | 24 Aug 2005 17:29 |
|---|---|---|---|
| Reporter: | Jim Winstead | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 5.0-bk | OS: | Any (*) |
| Assigned to: | Konstantin Osipov | CPU Architecture: | Any |
[26 Jul 2005 1:03]
Jim Winstead
[18 Aug 2005 19:38]
Jonathan Miller
Here is a row base replication version to try with your patch: ############################################################################# # Original Author: Jonathan Miller # # Original Date: Aug/18/2005 # ############################################################################# #TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 # ############################################################################# # Includes -- source include/have_binlog_format_row.inc -- source include/master-slave.inc # Begin clean up test section connection master; --disable_warnings DROP PROCEDURE IF EXISTS test.p1; DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; # Begin test section 1 CREATE TABLE test.t1 (a INT, PRIMARY KEY(a)); INSERT INTO test.t1 VALUES (1),(2),(3),(4); CREATE TABLE test.t2 (a INT, PRIMARY KEY(a)); delimiter |; CREATE PROCEDURE test.p1 (arg1 CHAR(1)) BEGIN DECLARE b, c INT; IF arg1 = 'a' THEN BEGIN DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2; DECLARE continue handler for not found set b = 1; SET b = 0; OPEN cur1; c1_repeat: REPEAT FETCH cur1 INTO c; IF (b = 1) THEN LEAVE c1_repeat; END IF; INSERT INTO test.t2 VALUES (c); UNTIL b = 1 END REPEAT; CLOSE cur1; END; END IF; IF arg1 = 'b' THEN BEGIN DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2; DECLARE continue handler for not found set b = 1; SET b = 0; OPEN cur2; c2_repeat: REPEAT FETCH cur2 INTO c; IF (b = 1) THEN LEAVE c2_repeat; END IF; INSERT INTO test.t2 VALUES (c); UNTIL b = 1 END REPEAT; CLOSE cur2; END; END IF; END| delimiter ;| CALL test.p1('a'); SELECT * FROM test.t2; connection slave; sleep 3; SELECT * FROM test.t2; connection master; truncate test.t2; # this next call fails, but should not call test.p1('b'); select * from test.t2; connection slave; sleep 3; SELECT * FROM test.t2; connection master; truncate test.t2; connection slave; #SELECT * FROM test.t2; connection master; #show binlog events; # lets cleanup DROP PROCEDURE test.p1; DROP TABLE test.t1; DROP TABLE test.t2;
[18 Aug 2005 22:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/28487
[19 Aug 2005 13:06]
Konstantin Osipov
Fixed in 5.0 tree, currently tagged 5.0.12
[19 Aug 2005 13:08]
Konstantin Osipov
A new patch: http://lists.mysql.com/internals/28530
[24 Aug 2005 17:27]
Mike Hillyer
Documented in 5.0.12 changelog: <listitem><para>Duplicate instructions in stored procedures resulted in incorrect execution when the optimizer optimized the duplicate code away. (Bug #12168)</para></listitem>
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.061 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.