diff options
| author | Sergey Glukhov <sergey.glukhov@oracle.com> | 2011-08-02 11:33:45 +0400 |
|---|---|---|
| committer | Sergey Glukhov <sergey.glukhov@oracle.com> | 2011-08-02 11:33:45 +0400 |
| commit | de3693a1cd292af3efd8841414da866ee2c2e1de (patch) | |
| tree | 12ae3424978cad870dff4198962862e5c0573ab0 /sql/sql_insert.cc | |
| parent | 7841c3f574a7a12b8ed44001b92da7f28764de63 (diff) | |
| download | mariadb-git-de3693a1cd292af3efd8841414da866ee2c2e1de.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.
Diffstat (limited to 'sql/sql_insert.cc')
| -rw-r--r-- | sql/sql_insert.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index baf5af16e2b..e176e5c9b6d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -631,7 +631,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, lock_type= table_list->lock_type; thd_proc_info(thd, "init"); - thd->used_tables=0; + thd->lex->used_tables=0; values= its++; value_count= values->elements; @@ -779,7 +779,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, } else { - if (thd->used_tables) // Column used in values() + if (thd->lex->used_tables) // Column used in values() restore_record(table,s->default_values); // Get empty record else { |
