Bug #13452 | UNION + VIEW == ERROR 1048 (23000), Column 'id1' cannot be null | ||
---|---|---|---|
Submitted: | 24 Sep 2005 0:30 | Modified: | 29 Sep 2005 21:57 |
Reporter: | Timothy Smith | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Views | Severity: | S2 (Serious) |
Version: | 5.0 | OS: | Any (all) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[24 Sep 2005 0:30]
Timothy Smith
[29 Sep 2005 21:53]
Sergey Petrunya
The root of the problem is not with UNION or with VIEWS. The problem is caused by wrong behavior with nested outer joins: mysql> select t1.id1 from t1 inner join (t3 left join v on t3.id3 = v.id3); +-----+ | id1 | +-----+ |NULL | +-----+ 1 row in set (0.17 sec) -- v2 is a view that is the same as v1 except that ALGORITHM=TEMPTABLE is used: mysql> select t1.id1 from t1 inner join (t3 left join v2 on t3.id3 = v2.id3); +-----+ | id1 | +-----+ | 1 | | 2 | +-----+ 2 rows in set (0.05 sec) -- Substituting view v1 with its definition: mysql> select t1.id1 from t1 inner join (t3 left join (t4 join t2 on t4.id2 = t2.id2) on t3.id3 = t4.id3); +-----+ | id1 | +-----+ |NULL | +-----+ 1 row in set (1.27 sec) -- We get wrong result here.