Bug #40953 | SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error | ||
---|---|---|---|
Submitted: | 23 Nov 2008 2:20 | Modified: | 28 Jan 2009 22:00 |
Reporter: | Shawn Green | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.37,5.0.72,5.1.22, 6.0 | OS: | Any |
Assigned to: | Sergei Glukhov | CPU Architecture: | Any |
[23 Nov 2008 2:20]
Shawn Green
[25 Nov 2008 10:37]
Sveta Smirnova
Fails with 5.0.67 for me and with shorter query: SELECT a.CuId, cr.VUrl, count(*) count FROM Acs a STRAIGHT_JOIN Cres cr ON cr.AId=a.AId LEFT JOIN ( Cres cr2 JOIN AEs ae2 ON cr2.AEId=ae2.AEId ) ON a.AId=cr2.AId GROUP BY a.CuId, cr.VUrl;
[16 Dec 2008 16:14]
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/61783 2744 Sergey Glukhov 2008-12-16 Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error There are two instances of Cre (cr, cr2). cr2 should have maybe_null set in the st_table instance, cr should not. Because cr is considered to be dependent on Accounts, the code sets st_table::maybe_null for cr into 'true'. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join.
[16 Dec 2008 17:38]
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/61803 2744 Sergey Glukhov 2008-12-16 Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error There are two instances of t1 (cr, cr2). cr2 should have maybe_null set in the st_table instance, cr should not. Because cr is considered to be dependent on t2, the code sets st_table::maybe_null for cr into 'true'. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join.
[23 Dec 2008 9:45]
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/62239 2744 Sergey Glukhov 2008-12-23 Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error Table could be marked dependent because it is either 1) an inner table of an outer join, or 2) it is a part of STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not be assigned. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join.
[24 Dec 2008 15:24]
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/62302 2724 Sergey Glukhov 2008-12-24 Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error Table could be marked dependent because it is either 1) an inner table of an outer join, or 2) it is a part of STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not be assigned. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join.
[6 Jan 2009 13:57]
Bugs System
Pushed into 5.0.76 (revid:joro@sun.com-20090105160414-8q9j4bi1klkfwiup) (version source revid:azundris@mysql.com-20081230114734-nmsc37ak330zlygn) (merge vers: 5.0.76) (pib:6)
[7 Jan 2009 20:47]
Paul DuBois
Noted in 5.0.76 changelog. Certain SELECT queries could fail with a "Duplicate entry" error. Setting report to NDI pending push into 5.1.x/6.0.x.
[15 Jan 2009 6:40]
Bugs System
Pushed into 5.1.31 (revid:joro@sun.com-20090115053147-tx1oapthnzgvs1ro) (version source revid:azundris@mysql.com-20081230114838-cn52tu180wcrvh0h) (merge vers: 5.1.31) (pib:6)
[15 Jan 2009 16:34]
Paul DuBois
Noted in 5.1.31 changelog. Setting report to NDI pending push into 6.0.x.
[19 Jan 2009 11:33]
Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090115073240-1wanl85vlvw2she1) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:10]
Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 15:10]
Jon Stephens
Setting status back to NDI pending merge to 6.0 tree.
[19 Jan 2009 16:15]
Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)
[20 Jan 2009 19:00]
Bugs System
Pushed into 6.0.10-alpha (revid:joro@sun.com-20090119171328-2hemf2ndc1dxl0et) (version source revid:azundris@mysql.com-20081230114916-c290n83z25wkt6e4) (merge vers: 6.0.9-alpha) (pib:6)
[28 Jan 2009 22:00]
Paul DuBois
Noted in 6.0.10 changelog.