diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-08-30 11:38:49 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-08-30 11:38:49 +0400 |
commit | 54e4516063c93c8f78ec99d37f3bda1aa22820a4 (patch) | |
tree | 29a2f71bf420dd6d81bf4c1c4232c900ed1779f0 | |
parent | f32c08bd0ca20d23e95ca46912044d48282cfd6f (diff) | |
parent | 6ce48392ea410ecb9937ea07943cc6434a5ac378 (diff) | |
download | mariadb-git-54e4516063c93c8f78ec99d37f3bda1aa22820a4.tar.gz |
Automerge.
-rw-r--r-- | mysql-test/r/group_min_max.result | 12 | ||||
-rw-r--r-- | mysql-test/t/group_min_max.test | 15 | ||||
-rw-r--r-- | sql/opt_range.cc | 12 |
3 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 27448d3e949..ac9a53ca238 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2502,3 +2502,15 @@ a MAX(b) 2 1 DROP TABLE t; End of 5.0 tests +# +# Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in +# server crash +# +CREATE TABLE t (a INT, b INT, INDEX (a,b)); +INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1); +INSERT INTO t SELECT * FROM t; +SELECT a, MAX(b) FROM t WHERE b GROUP BY a; +a MAX(b) +2 1 +DROP TABLE t; +End of 5.1 tests diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 981be3efece..c09a4fbf490 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1018,3 +1018,18 @@ DROP TABLE t; --echo End of 5.0 tests + +--echo # +--echo # Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in +--echo # server crash +--echo # + +CREATE TABLE t (a INT, b INT, INDEX (a,b)); +INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1); +INSERT INTO t SELECT * FROM t; + +SELECT a, MAX(b) FROM t WHERE b GROUP BY a; + +DROP TABLE t; + +--echo End of 5.1 tests diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 3e18d20c903..49a10f166fa 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -9639,7 +9639,17 @@ check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item, */ if (cond_type == Item::SUBSELECT_ITEM) DBUG_RETURN(FALSE); - + + /* + Condition of the form 'field' is equivalent to 'field <> 0' and thus + satisfies the SA3 condition. + */ + if (cond_type == Item::FIELD_ITEM) + { + DBUG_PRINT("info", ("Analyzing: %s", cond->full_name())); + DBUG_RETURN(TRUE); + } + /* We presume that at this point there are no other Items than functions. */ DBUG_ASSERT(cond_type == Item::FUNC_ITEM); |