summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2011-08-02 11:33:45 +0400
committerSergey Glukhov <sergey.glukhov@oracle.com>2011-08-02 11:33:45 +0400
commit3468b55a215d1c4b489dbb925f19176e12c9f242 (patch)
tree12ae3424978cad870dff4198962862e5c0573ab0 /sql/sql_class.cc
parent58cf757f0b28108884fd0c9f641ba31296dc6c45 (diff)
downloadmariadb-git-3468b55a215d1c4b489dbb925f19176e12c9f242.tar.gz
Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
There is an optimization of DISTINCT in JOIN::optimize() which depends on THD::used_tables value. Each SELECT statement inside SP resets used_tables value(see mysql_select()) and it leads to wrong result. The fix is to replace THD::used_tables with LEX::used_tables. mysql-test/r/sp.result: test case mysql-test/t/sp.test: test case sql/sql_base.cc: THD::used_tables is replaced with LEX::used_tables sql/sql_class.cc: THD::used_tables is replaced with LEX::used_tables sql/sql_class.h: THD::used_tables is replaced with LEX::used_tables sql/sql_insert.cc: THD::used_tables is replaced with LEX::used_tables sql/sql_lex.cc: THD::used_tables is replaced with LEX::used_tables sql/sql_lex.h: THD::used_tables is replaced with LEX::used_tables sql/sql_prepare.cc: THD::used_tables is replaced with LEX::used_tables sql/sql_select.cc: THD::used_tables is replaced with LEX::used_tables
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc1
1 files changed, 0 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index b9df35fe8be..7fb1d2ade5f 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -649,7 +649,6 @@ THD::THD()
is_slave_error= thread_specific_used= FALSE;
hash_clear(&handler_tables_hash);
tmp_table=0;
- used_tables=0;
cuted_fields= sent_row_count= row_count= 0L;
limit_found_rows= 0;
row_count_func= -1;