diff options
author | gkodinov/kgeorge@macbook.gmz <> | 2006-08-10 16:45:02 +0300 |
---|---|---|
committer | gkodinov/kgeorge@macbook.gmz <> | 2006-08-10 16:45:02 +0300 |
commit | 9ff33b5d93b64fa26470099b7c96414542e67f78 (patch) | |
tree | 08930b60207d2c18d8cacb4cfddc123087266207 /sql/opt_sum.cc | |
parent | 40a1fbdffb778825d8330bed83b28d8209e27b27 (diff) | |
download | mariadb-git-9ff33b5d93b64fa26470099b7c96414542e67f78.tar.gz |
Bug #16792 query with subselect, join, and group not returning proper values
Treat queries with no FROM and aggregate functions as normal queries,
so the aggregate function get correctly calculated as if there is 1 row.
This means that they will be considered to have one row, so COUNT(*) will return
1 instead of 0. Other aggregates will behave in compatible manner.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index b53fbfd3f80..bc98c96b5a8 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -182,7 +182,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) Type of range for the key part for this field will be returned in range_fl. */ - if ((outer_tables & table->map) || + if (table->file->inited || (outer_tables & table->map) || !find_key_for_maxmin(0, &ref, item_field->field, conds, &range_fl, &prefix_len)) { @@ -269,7 +269,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) Type of range for the key part for this field will be returned in range_fl. */ - if ((outer_tables & table->map) || + if (table->file->inited || (outer_tables & table->map) || !find_key_for_maxmin(1, &ref, item_field->field, conds, &range_fl, &prefix_len)) { |