Hans van Dalen <[EMAIL PROTECTED]> wrote: > > A question about locking. In my code (delphi but that doesn't much matter) > I fire ad-hoc queries (select). Before the query i fire a locking query > (read) for that particular tables. Something like this: > > lock tables tab1 a read, tab2 b read > (execute) > select * from tab1 a, tab2 b where......... > (execute) > > In this case I get an error: tab1 is not locked using LOCK TABLES.
Works fine for me: mysql> lock tables tab1 a read, tab2 b read; Query OK, 0 rows affected (0.00 sec) mysql> select * from tab1 a, tab2 b where a.id=b.id; +------+------+ | id | id | +------+------+ | 2 | 2 | +------+------+ 1 row in set (0.00 sec) What exactly versions do you use? > If I change the locking query to: lock tables tab1 read, tab2 b read > The first times I didn't get any error. But after some times of running my > app the error: a is not locked using LOCK TABLES occur!?!? > > Ok finally I use the statement: lock tables tab1 read, tab1 a read, tab2 b > read > en everything works fine. > > The strangest thing about this is that sometimes it doesn't go wrong > (locking using the lock statement with only the table aliases), other times > it goes. > > When I execute the locking and the select query from my SQL explorer > (borland) nothing is going wrong (makes no sense whatever you lock). > > It makes no difference I use version 4.0/4.1/5.0 (on suse linux). > > Anybody who has seen this before????? > > Okay the workaround is simple: don't use table aliases or use the above > showed locking statement, but it makes me angry something like this errors > are raised on unexpected moments in my production environment,. > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [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]