summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-03-07 14:40:37 +0200
committerunknown <monty@mashka.mysql.fi>2003-03-07 14:40:37 +0200
commit157b36675eccce990a816532153bb2eb61aa139c (patch)
treee4fb25e07ebfe47403d42ac74d2ee8b38cfef27b /sql
parent5861dc5b8b39b3f822a8968963a4783541d59b77 (diff)
downloadmariadb-git-157b36675eccce990a816532153bb2eb61aa139c.tar.gz
Fixed an unlikely optimizer bug that casued a core dump in pt_range.cc::sel_cmp()
mysql-test/r/join.result: Test of range optimizer bug mysql-test/t/join.test: Test of range optimizer bug sql/sql_rename.cc: Added missing DEBUG_PRINT()
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_range.cc12
-rw-r--r--sql/sql_rename.cc4
2 files changed, 10 insertions, 6 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index b2128c3eb4a..931093d548a 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1341,7 +1341,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
}
if (((clone_flag & CLONE_KEY2_MAYBE) &&
- !(clone_flag & CLONE_KEY1_MAYBE)) ||
+ !(clone_flag & CLONE_KEY1_MAYBE) &&
+ key2->type != SEL_ARG::MAYBE_KEY) ||
key1->type == SEL_ARG::MAYBE_KEY)
{ // Put simple key in key2
swap(SEL_ARG *,key1,key2);
@@ -1369,7 +1370,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
{
key1->maybe_smaller();
if (key2->next_key_part)
+ {
+ key1->use_count--; // Incremented in and_all_keys
return and_all_keys(key1,key2,clone_flag);
+ }
key2->use_count--; // Key2 doesn't have a tree
}
return key1;
@@ -2068,7 +2072,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
{
if (this == root && use_count != 1)
{
- sql_print_error("Use_count: Wrong count %lu for root",use_count);
+ sql_print_error("Note: Use_count: Wrong count %lu for root",use_count);
return;
}
if (this->type != SEL_ARG::KEY_RANGE)
@@ -2082,7 +2086,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
ulong count=count_key_part_usage(root,pos->next_key_part);
if (count > pos->next_key_part->use_count)
{
- sql_print_error("Use_count: Wrong count for key at %lx, %lu should be %lu",
+ sql_print_error("Note: Use_count: Wrong count for key at %lx, %lu should be %lu",
pos,pos->next_key_part->use_count,count);
return;
}
@@ -2090,7 +2094,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
}
}
if (e_count != elements)
- sql_print_error("Wrong use count: %u for tree at %lx", e_count,
+ sql_print_error("Warning: Wrong use count: %u for tree at %lx", e_count,
(gptr) this);
}
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index 9eee8ccf7ac..c4af966d145 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -122,7 +122,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
if (!access(name,F_OK))
{
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),name);
- return ren_table; // This can't be skipped
+ DBUG_RETURN(ren_table); // This can't be skipped
}
sprintf(name,"%s/%s/%s%s",mysql_data_home,
ren_table->db,ren_table->real_name,
@@ -131,7 +131,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
{
my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
if (!skip_error)
- return ren_table;
+ DBUG_RETURN(ren_table);
}
else if (mysql_rename_table(table_type,
ren_table->db, ren_table->real_name,