Bug #2940 Multi-table DELETE won't accept table aliases
Submitted: 24 Feb 2004 11:21 Modified: 9 Mar 2004 23:57
Reporter: Dean Ellis Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.18 OS:
Assigned to: Michael Widenius CPU Architecture:Any

[24 Feb 2004 11:21] Dean Ellis
Multi-table DELETE statements report "ERROR 1066: Not unique table/alias" for aliased tables.

How to repeat:
CREATE TABLE test ( a int );
CREATE TABLE test2 ( a int );
DELETE test FROM test, test t2;
DELETE t2 FROM test, test t2;
DELETE t1 FROM test t1, test t2;
DELETE t1 FROM test t1, test2;
DROP TABLE test, test2;

Suggested fix:
[24 Feb 2004 12:13] Sinisa Milivojevic
A fix for the bug is proposed.
[9 Mar 2004 23:57] Michael Widenius
We can't fix this in 4.0 as we belive some old applications depend on queries like the following:

SELECT test.* FROM test as t1, test2 WHERE ....

This is hower fixed in the 4.1 source tree and will appear in 4.1.2