Bug #13392 | values() fails with 'ambiguous' or returns NULL with ON DUPLICATE and SELECT | ||
---|---|---|---|
Submitted: | 21 Sep 2005 22:47 | Modified: | 31 Oct 2005 20:13 |
Reporter: | Dave Pullin (Basic Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.12-beta-nt-log | OS: | Any (All) |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[21 Sep 2005 22:47]
Dave Pullin
[21 Sep 2005 23:15]
Jorge del Conde
Thanks for your bug report. I was able to reproduce this bug using 5.0.12 from bk under FC4 (Linux)
[14 Oct 2005 22:42]
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/internals/31125
[14 Oct 2005 22:54]
Evgeny Potemkin
According to documentation "VALUES(col_name) in the UPDATE clause refers to the value of col_name that would be inserted, had no duplicate-key conflict occurred." http://dev.mysql.com/doc/refman/5.0/en/insert.html So: insert into temp (x,y,z) select x,y,z from tempupdates as up ON DUPLICATE KEY UPDATE y=values(y); Returns error - bug, should be fixed. insert into temp (x,y,z) select x,y as yu,z from tempupdates as up ON DUPLICATE KEY UPDATE y=values(yu); This is ok, because there is no 'yu' column in 'temp' table. insert into temp (x,y,z) select x,y as yu,z from tempupdates as up ON DUPLICATE KEY UPDATE y=values(up.yu); insert into temp (x,y,z) select x,y as yu,z from tempupdates as up ON DUPLICATE KEY UPDATE y=values(up.y); Allows 'up' table in values() - bug, should be fixed.
[25 Oct 2005 16:22]
Evgeny Potemkin
Item_insert_value::fix_fields() passed to it's arg full table list, This results in finding second column which shouldn't be found, and failing with error about ambiguous field. Fixed in 4.1.16, cset 1.2462.1.1
[28 Oct 2005 14:10]
Evgeny Potemkin
Fixed in 5.0.16
[31 Oct 2005 20:13]
Paul DuBois
Noted in 4.1.16, 5.0.16 changelogs.