| Bug #25122 | insertability of views not consistent | ||
|---|---|---|---|
| Submitted: | 17 Dec 2006 20:17 | Modified: | 16 Mar 2007 17:35 |
| Reporter: | Martin Friebe (Gold Quality Contributor) (SCA) | ||
| Status: | Closed | ||
| Category: | Server: Views | Severity: | S3 (Non-critical) |
| Version: | 5.0.34-BK, 5.0.30 | OS: | Linux (Linux, freebsd) |
| Assigned to: | Evgeny Potemkin | Target Version: | |
| Tags: | insert, VIEW | ||
[17 Dec 2006 20:17]
Martin Friebe
[18 Dec 2006 23:26]
Valeriy Kravchuk
Thank you for a problem report. Verified just as described with latest 5.0.34-BK on Linux. As you already noted, it is either a bug (I think so), or a request for explicit and proper documentation of this behaviour.
[19 Dec 2006 15:22]
Martin Friebe
If it is a bug, then still some documentation may be needed, because the self join will not work with the "with check option". (unless the view does not have join conditions) because otherwise the check has to read the same table as the table that is inserted into. Without the "with check option", there should be no issue allowing this.
[27 Feb 2007 21:03]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20686 ChangeSet@1.2419, 2007-02-27 23:02:28+03:00, evgen@moonbone.local +9 -0 Bug#25122: Views based on a self-joined table aren't insertable. When INSERT is done over a view the table being inserted into is checked to be unique among all views tables. But if the view contains self-joined table an error will be thrown even if all tables are used under different aliases. The unique_table() function now also checks tables' aliases when needed.
[2 Mar 2007 13:10]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/21011 ChangeSet@1.2419, 2007-03-02 00:09:22+03:00, evgen@moonbone.local +7 -0 Bug#25122: Views based on a self-joined table aren't insertable. When INSERT is done over a view the table being inserted into is checked to be unique among all views tables. But if the view contains self-joined table an error will be thrown even if all tables are used under different aliases. The unique_table() function now also checks tables' aliases when needed.
[12 Mar 2007 6:10]
Igor Babaev
Pushed to 5.0.38, 5.1.17
[16 Mar 2007 17:35]
Paul DuBois
Noted in 5.0.38, 5.1.17 changelogs. A view on a join is insertable for INSERT statements that store values into only one table of the join. However, inserts were being rejected if the inserted-into table was used in a self-join because MySQL incorrectly was considering the insert to modify multiple tables of the view.
