Bug #68372 | Function ifnull has ignored when used with select with some others selects | ||
---|---|---|---|
Submitted: | 13 Feb 2013 18:59 | Modified: | 4 Mar 2013 19:08 |
Reporter: | Luis A S Junior Camargo | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
Version: | 5.6.10 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | regression |
[13 Feb 2013 18:59]
Luis A S Junior Camargo
[13 Feb 2013 19:00]
Luis A S Junior Camargo
table pedcompralote
Attachment: comprapedlote.sql (application/octet-stream, text), 1.65 KiB.
[13 Feb 2013 19:00]
Luis A S Junior Camargo
table pedcompralotecodbarras
Attachment: comprapedlotecodbarras.sql (application/octet-stream, text), 658 bytes.
[13 Feb 2013 19:21]
Valeriy Kravchuk
This is what I get on 5.5.29 with your test: mysql> select ifnull(count(*),3) from comprapedlotecodbarras where pedcompralote =11725; +--------------------+ | ifnull(count(*),3) | +--------------------+ | 0 | +--------------------+ 1 row in set (0.16 sec) mysql> select (select ifnull(count(*),3) from comprapedlotecodbarras where pedco mpralote=11725) as tot,ifnull(max(pedcompraseq),0)+1 as newcode from comprapedlo tecodbarras where pedcompralote in(select cod from comprapedlote where ped=1779) ; +------+---------+ | tot | newcode | +------+---------+ | 0 | 1 | +------+---------+ 1 row in set (0.38 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.5.29 | +-----------+ 1 row in set (0.00 sec)
[13 Feb 2013 19:24]
Valeriy Kravchuk
The results on 5.6.10: mysql> select (select ifnull(count(*),3) from comprapedlotecodbarras where pedco mpralote=11725) as tot,ifnull(max(pedcompraseq),0)+1 as newcode from comprapedlo tecodbarras where pedcompralote in(select cod from comprapedlote where ped=1779) ; +------+---------+ | tot | newcode | +------+---------+ | NULL | 1 | +------+---------+ 1 row in set (0.05 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.6.10 | +-----------+ 1 row in set (0.00 sec) So, there are reasons to claim we have a regression bug here...
[13 Feb 2013 21:05]
MySQL Verification Team
Thank you for the bug report. Verified as described.
[4 Mar 2013 19:08]
Paul DuBois
Noted in 5.6.11, 5.7.1 changelogs. A statement with an aggregated, nongrouped outer query and an aggregated, nongrouped subquery in the SELECT list could return incorrect results.