Bug #54515 | Crash in opt_range.cc::get_best_group_min_max on SELECT from VIEW with GROUP BY | ||
---|---|---|---|
Submitted: | 15 Jun 2010 14:14 | Modified: | 20 Nov 2010 23:23 |
Reporter: | John Embretsen | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
Version: | 5.5.5-m3-Celosia, 5.6.99-Dahlia, 6.0.14 | OS: | Any |
Assigned to: | Jørgen Løland | CPU Architecture: | Any |
Tags: | regression |
[15 Jun 2010 14:14]
John Embretsen
[15 Jun 2010 14:23]
Valeriy Kravchuk
Verified just as described on Mac OS X. Note that 5.1.49 does NOT crash: valeriy-kravchuks-macbook-pro:5.1 openxs$ bin/mysql -uroot testReading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 34 Server version: 5.1.49-debug Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> DROP TABLE IF EXISTS t1; Query OK, 0 rows affected (0.00 sec) mysql> DROP VIEW IF EXISTS view_t1; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> mysql> CREATE TABLE t1 ( -> col_int_key int DEFAULT NULL, -> KEY int_key (col_int_key) -> ) ENGINE=InnoDB; Query OK, 0 rows affected (0.06 sec) mysql> mysql> CREATE VIEW view_t1 AS -> select t1.col_int_key AS col_int_key -> from t1; Query OK, 0 rows affected (0.19 sec) mysql> mysql> SELECT col_int_key FROM view_t1 GROUP BY col_int_key; Empty set (0.00 sec) So, this is a regression. Actually, -debug version shows that we have assertion failure here: Version: '5.5.5-m3-debug' socket: '/tmp/mysql.sock' port: 3306 Source distribution Assertion failed: ((*tmp_group->item)->type() == Item::FIELD_ITEM), function get_best_group_min_max, file opt_range.cc, line 9639. 100615 17:21:16 - mysqld got signal 6 ;
[16 Jun 2010 11:44]
John Embretsen
Data point: This bug is similar to Bug#29104, fixed in 2007.
[16 Jun 2010 12:40]
Jørgen Løland
Also crashes for MyISAM if you insert a few rows: DROP TABLE IF EXISTS t1; DROP VIEW IF EXISTS view_t1; CREATE TABLE t1 ( col_int_key int DEFAULT NULL, KEY int_key (col_int_key) ) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2); CREATE VIEW view_t1 AS SELECT t1.col_int_key AS col_int_key FROM t1; SELECT col_int_key FROM view_t1 GROUP BY col_int_key; DROP VIEW view_t1; DROP TABLE t1;
[17 Jun 2010 7:46]
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/111365 3199 Jorgen Loland 2010-06-17 Bug#54515: Crash in opt_range.cc::get_best_group_min_max on SELECT from VIEW with GROUP BY When handling the grouping items in get_best_group_min_max, the items need to be of type Item_field. In this bug, an ASSERT triggered because the item used for grouping was an Item_direct_view_ref (i.e., the group column is from a view). The fix is to get the real_item since Item_ref* pointing to Item_field is ok. @ mysql-test/r/select.result Add test for BUG#54515 @ mysql-test/r/select_jcl6.result Add test for BUG#54515 @ mysql-test/t/select.test Add test for BUG#54515 @ sql/opt_range.cc Get the real_item() when processing grouping items in get_best_group_min_max.
[18 Jun 2010 9:32]
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/111525 3200 Jorgen Loland 2010-06-18 Bug#54515: Crash in opt_range.cc::get_best_group_min_max on SELECT from VIEW with GROUP BY When handling the grouping items in get_best_group_min_max, the items need to be of type Item_field. In this bug, an ASSERT triggered because the item used for grouping was an Item_direct_view_ref (i.e., the group column is from a view). The fix is to get the real_item since Item_ref* pointing to Item_field is ok. @ mysql-test/r/select.result Add test for BUG#54515 @ mysql-test/r/select_jcl6.result Add test for BUG#54515 @ mysql-test/t/select.test Add test for BUG#54515 @ sql/opt_range.cc Get the real_item() when processing grouping items in get_best_group_min_max.
[18 Jun 2010 12:48]
Jørgen Løland
Pushed to next-mr-opt-backporting
[18 Jun 2010 14:36]
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/111561 3203 Oystein Grovlen 2010-06-18 [merge] Merge test restructuring with Bug#54515. Update all result files affected by new test case.
[8 Jul 2010 13:37]
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/113134 3295 Olav Sandstaa 2010-07-08 [merge] Merging fix for Bug#54515 from mysql-trunk-bugfixing to mysql-next-mr-bugfixing.
[8 Jul 2010 13:48]
Olav Sandstå
Backported patch from mysql-next-mr-opt-backporting to mysql-trunk-bugfixing with revision id: olav@sun.com-20100708131905-2i3p7esvpbb2qjts. Merged this patch to mysql-next-mr-bugfixing.
[23 Jul 2010 12:24]
Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:31]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[2 Aug 2010 19:40]
Paul DuBois
Noted in 5.5.6 changelog. Queries that named view columns in a GROUP BY clause could cause a server crash.
[4 Aug 2010 8:04]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[4 Aug 2010 8:20]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[4 Aug 2010 23:11]
Paul DuBois
Bug does not appear in any released 5.6.x version.
[16 Aug 2010 6:34]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[13 Nov 2010 16:24]
Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)