Bug #36561 | Server doesn't report a syntax error in subquery | ||
---|---|---|---|
Submitted: | 7 May 2008 11:51 | Modified: | 7 May 2008 14:56 |
Reporter: | Sergey Kudriavtsev | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.1 | OS: | Linux (Ubuntu 7.10) |
Assigned to: | CPU Architecture: | Any | |
Tags: | error handling, subquery, syntax error |
[7 May 2008 11:51]
Sergey Kudriavtsev
[7 May 2008 14:56]
Valeriy Kravchuk
I think this is not a bug. In your DELETE: delete from t1 where ix in (select ix from t3); server can not find ix column in the t3 table, but then it searches this column in table from outer query. And, surely, there is ix column in t1. Hence the results... This is a documented behaviour. Please, read http://dev.mysql.com/doc/refman/5.1/en/correlated-subqueries.html: "Scoping rule: MySQL evaluates from inside to outside." MySQL server does NOT know if your use of ix was intentional or a misprint, and process subquery as correlated, referring to ix column in the t1.