diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-08-30 11:03:37 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2009-08-30 11:03:37 +0400 |
commit | 6ce48392ea410ecb9937ea07943cc6434a5ac378 (patch) | |
tree | 1c15cdce0c89a90c59b4df7d918a66bba5378f5a /sql/opt_range.cc | |
parent | 99734bed4042d9bef6caf9f9ebda743df86797ac (diff) | |
download | mariadb-git-6ce48392ea410ecb9937ea07943cc6434a5ac378.tar.gz |
Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM)
results in server crash
check_group_min_max_predicates() assumed the input condition
item to be one of COND_ITEM, SUBSELECT_ITEM, or FUNC_ITEM.
Since a condition of the form "field" is also a valid condition
equivalent to "field <> 0", using such a condition in a query
where the loose index scan was chosen resulted in a debug
assertion failure.
Fixed by handling conditions of the FIELD_ITEM type in
check_group_min_max_predicates().
mysql-test/r/group_min_max.result:
Added a test case for bug #46607.
mysql-test/t/group_min_max.test:
Added a test case for bug #46607.
sql/opt_range.cc:
Handle conditions of the FUNC_ITEM type in
check_group_mix_max_predicates().
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index e3aef02637f..d7438b7b9cc 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -9628,7 +9628,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); |