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

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

Reply via email to