Bug #65255 Multi-table DELETE with aliases and no default databa causes syntax error in 5.5
Submitted: 9 May 2012 13:38 Modified: 10 May 2012 16:53
Reporter: Baron Schwartz (Basic Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.5.20 OS:Any
Assigned to: CPU Architecture:Any

[9 May 2012 13:38] Baron Schwartz
Description:
The instructions given in http://dev.mysql.com/doc/refman/5.5/en/upgrading-from-previous-series.html do not appear to work correctly when tables are both aliased and outside the default database. I cannot find a way to write the following statement against the sakila database if I use aliases and do not have a default database:

delete sakila.actor from sakila.actor inner join sakila.film_actor on actor.actor_id = film_actor.actor_id where sakila.actor.actor_id < 0

Without database-qualifying the table to delete from, I get "No database selected." If I database-qualify it, I get "Unknown table."

How to repeat:
mysql> delete actor from sakila.actor as a inner join sakila.film_actor as fa on a.actor_id = fa.actor_id where a.actor_id < 0;
ERROR 1046 (3D000): No database selected

mysql> delete a from sakila.actor as a inner join sakila.film_actor as fa on a.actor_id = fa.actor_id where a.actor_id < 0;
ERROR 1046 (3D000): No database selected

mysql> delete sakila.actor from sakila.actor as a inner join sakila.film_actor as fa on a.actor_id = fa.actor_id where a.actor_id < 0;
ERROR 1109 (42S02): Unknown table 'actor' in MULTI DELETE

mysql> delete sakila.a from sakila.actor as a inner join sakila.film_actor as fa on a.actor_id = fa.actor_id where a.actor_id < 0;
ERROR 1109 (42S02): Unknown table 'a' in MULTI DELETE
[9 May 2012 15:19] Davi Arnaut
Bug#61376
[10 May 2012 16:53] Sveta Smirnova
Thank you for the report.

Closing as duplicate of bug #61376 which Davi referenced.