[MDEV-4826] UPDATE in Stored Function is not rolled back Created: 2013-07-30 Updated: 2014-06-06 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.3, 5.5.32, 5.1.67, 5.2.14, 5.3.12, 10.0.10 |
| Fix Version/s: | 5.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Federico Razzoli | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | upstream | ||
| Description |
|
This happened to me in 10.0 on WinXP; don't know about other platforms/versions. First, I create a 2-rows table with a primary key. Then I start a transaction and invoke a function which tries to set both values to 10. The first value is updated, the second value fails (duplicate value), but the first operation is not rollback, so I get a row with id=10. Here's the code:
As far as I understand from this page, this is a bug: In my test a DECLARE CONTINUE HANDLER is used, but I couldn't find transaction information in the DECLARE HANDLER page or similar pages. |
| Comments |
| Comment by Elena Stepanova [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Federico, It seems to be a tricky issue. If you hadn't done that, the result would have been as you expected. On the other hand, it's not as obvious as a case with two subsequent updates would have been: Here one could totally expect the result of the first statement to be preserved; but should it be so inside a single statement? I can't say for certain one way or another. My bet is on "it's by design (of error handlers in stored procedures)", but if you have doubts, I can get a second opinion. Alternatively, you can try to file a bug at MySQL and see what they think about it (it works the same way in MySQL). One thing is obvious though, the behavior of InnoDB error handling together with stored procedures error handling should be documented somewhere; maybe it is, but I couldn't find it. So, at least the doc request is due. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Elena, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi again,
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, I agree, that's weird. I think it's worth filing for upstream and seeing what they say – if nothing else, this way we'll get it documented. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm sorry, I dont want to register on Oracle site because they ask too many personal information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
No problem, I understand your point. Filed as http://bugs.mysql.com/bug.php?id=69872 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It turned out to be a duplicate of http://bugs.mysql.com/bug.php?id=51006. I pressed the "Affect me" button on your behalf |