List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 5 2003 6:29pm
Subject:Re: Re: LOCK problem with SELECT table alias
View as plain text  
At 14:45 +0100 1/5/03, ck@stripped wrote:
>   >Description:
>	A SELECT statement fails if you have table aliases and use
>	table locking with the LOCK command

This is not a bug.  It's documented in the manual that you must lock
all the tables at once that you intend to use, *including* locking
any aliases for those tables that you'll use.

>   >How-To-Repeat:
>	DROP TABLE IF EXISTS CK1;
>          CREATE TABLE CK1 (
>            ID INT UNSIGNED NOT NULL,
>            PRIMARY KEY(ID)
>          );
>          LOCK TABLES CK1 READ; # you must have locking privileges
>          SELECT * FROM CK1; # works
>          SELECT * FROM CK1 AS SOME_ALIAS; # fails, error 1100: Table
>'SOME_ALIAS' was not locked with LOCK TABLES
>          UNLOCK TABLES;
>>Fix:
>	Do not check for aliases, but for table names.

sql, query
Thread
Re: Re: LOCK problem with SELECT table aliasPaul DuBois5 Jan
  • Re: LOCK problem with SELECT table aliasChristian Kohlschuetter5 Jan