Hello.


I think it is a weird behavior. I've reported a bug:



  http://bugs.mysql.com/bug.php?id=9511





  



Bob O'Neill <[EMAIL PROTECTED]> wrote:

> If I try to read table 'b' after locking table 'a', I expect to get

> the error message "Table 'b' was not locked with LOCK TABLES". 

> However, if my query that accesses table b is stored in the query

> cache, I don't get the error.  This causes a problem in the following

> scenario:

> 

> User 1:

> 

> LOCK TABLES a

> SELECT SQL_CACHE COUNT(*) FROM b

> (assume it was already cached)

> 

> User 2:

> 

> INSERT b VALUES('value');

> SELECT SQL_CACHE COUNT(*) FROM b

> (the SELECT puts the query back into the cache)

> 

> User 1:

> 

> SELECT SQL_CACHE COUNT(*) FROM b

> (now he gets a different result)

> UNLOCK TABLES

> 

> User 1 thinks that everything he's doing is safe inside of an

> "emulated transaction".  But the data in table b has changed between

> the LOCK and the UNLOCK, and User 1 isn't notified that he is doing

> anything wrong.

> 

> I think an appropriate fix would be to force User 1 to lock table b

> even though the results of that query are stored in the query cache. 

> Is this possible?

> 

> Thanks,

> -Bob

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to