summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2005-09-28 11:34:53 +0200
committerunknown <msvensson@neptunus.(none)>2005-09-28 11:34:53 +0200
commit69bfcd9c400e0b00fe53aaee8da0b38b0bf5f9ad (patch)
tree5b0761b29daf8c864538d0fb55e20e9b54758e47 /sql/opt_sum.cc
parent59041a2b356943bda95d38c10e9ba01f7b2c7a73 (diff)
parente4fe90bfa767366a4784adb4e7c65bca7c5c0537 (diff)
downloadmariadb-git-69bfcd9c400e0b00fe53aaee8da0b38b0bf5f9ad.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.0 client/mysql.cc: Auto merged client/mysqltest.c: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/t/mysqltest.test: Auto merged mysys/my_init.c: Auto merged sql/sql_update.cc: Auto merged Makefile.am: Manual merge mysql-test/r/cast.result: Manual merge mysql-test/t/cast.test: Manual merge ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp: Manual merge sql/ha_ndbcluster.cc: Manual merge sql/item.h: Manual merge sql/opt_sum.cc: Manual merge sql/sql_delete.cc: Manual merge sql/sql_lex.cc: Manual merge sql/sql_load.cc: Manual merge sql/sql_prepare.cc: Manual merge
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 2f54cce0275..37acce2934b 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -108,7 +108,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
WHERE t2.field IS NULL;
*/
if (tl->table->map & where_tables)
- const_result= 0;
+ return 0;
}
else
used_tables|= tl->table->map;
@@ -119,7 +119,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
may be used as the real count.
*/
if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT)
+ {
is_exact_count= FALSE;
+ count= 1; // ensure count != 0
+ }
else
{
tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@@ -127,9 +130,6 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
}
- if (!const_result)
- return 0;
-
/*
Iterate through all items in the SELECT clause and replace
COUNT(), MIN() and MAX() with constants (if possible).
@@ -250,7 +250,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
if (!count)
{
- /* If count != 1, then we know that is_exact_count == TRUE. */
+ /* If count == 0, then we know that is_exact_count == TRUE. */
((Item_sum_min*) item_sum)->clear(); /* Set to NULL. */
}
else