summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-05-03 16:21:43 +0300
committerunknown <monty@narttu.mysql.fi>2003-05-03 16:21:43 +0300
commit34c3c0279441554e8d42ff0ec18a2890c1a6e148 (patch)
tree30be27be6dac81e03afd60853ff3dae87c704e17 /sql/opt_sum.cc
parent6db41f7793d81c08f042e0b1ff23e5d387b2976f (diff)
downloadmariadb-git-34c3c0279441554e8d42ff0ec18a2890c1a6e148.tar.gz
Fix problem where key_read was not cleaned up properly, which caused assert in innodb test.
mysql-test/r/innodb.result: Changed tests to make them repeatable. mysql-test/t/innodb.test: Changed tests to make them repeatable. sql/opt_sum.cc: Safety fix sql/sql_base.cc: Safety assert
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index aeaf8beef07..21296845c21 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -191,13 +191,13 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
ref.key_buff=key_buff;
TABLE *table=((Item_field*) expr)->field->table;
- if ((outer_tables & table->map) ||
- !find_range_key(&ref, ((Item_field*) expr)->field,conds))
+ if ((table->file->table_flags() & HA_NOT_READ_AFTER_KEY))
{
const_result=0;
break;
}
- if ((table->file->table_flags() & HA_NOT_READ_AFTER_KEY))
+ if ((outer_tables & table->map) ||
+ !find_range_key(&ref, ((Item_field*) expr)->field,conds))
{
const_result=0;
break;
@@ -348,7 +348,13 @@ bool part_of_cond(COND *cond,Field *field)
}
-/* Check if we can get value for field by using a key */
+/*
+ Check if we can get value for field by using a key
+
+ NOTES
+ This function may set table->key_read to 1, which must be reset after
+ index is used! (This can only happen when function returns 1)
+*/
static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond)
{