MySQL Forums
Forum List  »  InnoDB

SELECT FOR UPDATE problem
Posted by: Alexander Blagoev
Date: November 10, 2008 11:35AM

Hello, I'm using
5.0.32-Debian_7etch6
InnoDB

I have a problem with SELECT FOR UPDATE statement, if I understood correctly SELECT FOR UPDATE should prevent other threads reading the selected rows
i.e.
SESSION:1
SET AUTOCOMMIT = 0;
START TRANSACTION;
SELECT `id`
FROM `test`
WHERE 1
FOR UPDATE

SESSION:2
SELECT `id`
FROM `test`
WHERE 1

SESSION2 should be blocked untill SESSION1 commits right?(meaning SESSION2 shouldn't receive a result set from the SELECT query unitll SESSION1 commits)
The problem is this doesn't happen SESSION2 selects without a problem, even though SESSION1 hasn't commited. If i try to update from SESSION2 things work as expected(SESSION2 waits untill SESSION1 commits). Any ideas?(LOCK TABLES is not an option)
Thanks in advance.



Edited 1 time(s). Last edit at 11/10/2008 11:43AM by Alexander Blagoev.

Options: ReplyQuote


Subject
Views
Written By
Posted
SELECT FOR UPDATE problem
13116
November 10, 2008 11:35AM
4597
January 31, 2009 04:25PM


Sorry, you can't reply to this topic. It has been closed.

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.