summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-02-27 22:37:46 -0800
committerIgor Babaev <igor@askmonty.org>2011-02-27 22:37:46 -0800
commit0f0360e21f45ad9704c8cb1014bf9d77a044a404 (patch)
tree29455c84f1eec9f742898593d282fc4c9f63dad8 /sql/sql_test.cc
parent1b03a028fcc4a4ac6337a64c9bb85add5c1ae6bc (diff)
downloadmariadb-git-0f0360e21f45ad9704c8cb1014bf9d77a044a404.tar.gz
Fixed LP bug #725050.
The bug in the function print_keyuse() caused crashes if hash join could be used. It happened because the function ignored the fact that KEYUSE structures could be created for hash joins as well.
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 5bf9cd1f77e..af89b3cd525 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -231,14 +231,18 @@ void print_keyuse(KEYUSE *keyuse)
char buff[256];
char buf2[64];
const char *fieldname;
+ JOIN_TAB *join_tab= keyuse->table->reginfo.join_tab;
+ KEY *key_info= join_tab->get_keyinfo_by_key_no(keyuse->key);
String str(buff,(uint32) sizeof(buff), system_charset_info);
str.length(0);
keyuse->val->print(&str, QT_ORDINARY);
str.append('\0');
- if (keyuse->keypart == FT_KEYPART)
+ if (keyuse->is_for_hash_join())
+ fieldname= keyuse->table->field[keyuse->keypart]->field_name;
+ else if (keyuse->keypart == FT_KEYPART)
fieldname= "FT_KEYPART";
else
- fieldname= keyuse->table->key_info[keyuse->key].key_part[keyuse->keypart].field->field_name;
+ fieldname= key_info->key_part[keyuse->keypart].field->field_name;
longlong2str(keyuse->used_tables, buf2, 16, 0);
DBUG_LOCK_FILE;
fprintf(DBUG_FILE, "KEYUSE: %s.%s=%s optimize: %u used_tables: %s "