diff options
author | unknown <igor@rurik.mysql.com> | 2006-01-06 22:28:26 -0800 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-01-06 22:28:26 -0800 |
commit | 312c2f4759514c6594e630e6d1237b8875022328 (patch) | |
tree | b8a215a1aea131a3018f2793e26e1c95276ef793 /sql/opt_sum.cc | |
parent | bf1ebe98dfe51c7f7b13e783cd13d8362a26afbf (diff) | |
download | mariadb-git-312c2f4759514c6594e630e6d1237b8875022328.tar.gz |
Fixed bug #16016: MIN/MAX optimization was not applied to views.
mysql-test/r/view.result:
Added a test case for bug #16016.
mysql-test/t/view.test:
Added a test case for bug #16016.
sql/opt_sum.cc:
Fixed bug #16016: MIN/MAX optimization was not applied to views.
The fix employs the standard way of handling direct references to view fields.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 37acce2934b..ed8e694dcb7 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -180,14 +180,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) indexes to find the key. */ Item *expr=item_sum->args[0]; - if (expr->type() == Item::FIELD_ITEM) + if (expr->real_item()->type() == Item::FIELD_ITEM) { byte key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; uint range_fl, prefix_len; ref.key_buff= key_buff; - Item_field *item_field= ((Item_field*) expr); + Item_field *item_field= (Item_field*) (expr->real_item()); TABLE *table= item_field->field->table; /* @@ -267,14 +267,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) indexes to find the key. */ Item *expr=item_sum->args[0]; - if (expr->type() == Item::FIELD_ITEM) + if (expr->real_item()->type() == Item::FIELD_ITEM) { byte key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; - uint range_fl, prefix_len; + uint range_fl, prefix_len; ref.key_buff= key_buff; - Item_field *item_field= ((Item_field*) expr); + Item_field *item_field= (Item_field*) (expr->real_item()); TABLE *table= item_field->field->table; /* |