Commit 94166de5 authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

sql_show.cc:

  Database name was set incorrectly for any show command
  that used sunqueries in its where condition.
information_schema.test, information_schema.result:
  Added a test case for bug #12636.
parent 8c34d8e5
Branches unavailable
Tags unavailable
No related merge requests found
...@@ -967,3 +967,11 @@ a NULL ...@@ -967,3 +967,11 @@ a NULL
b NULL b NULL
use test; use test;
drop table t1; drop table t1;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
SHOW TABLE STATUS FROM test
WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
...@@ -650,3 +650,18 @@ select column_name, column_default from columns ...@@ -650,3 +650,18 @@ select column_name, column_default from columns
where table_schema='test' and table_name='t1'; where table_schema='test' and table_name='t1';
use test; use test;
drop table t1; drop table t1;
#
# Bug #12636: SHOW TABLE STATUS with where condition containing a subquery
# over information schema
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
--replace_column 8 # 12 # 13 #
SHOW TABLE STATUS FROM test
WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
DROP TABLE t1,t2
...@@ -1705,7 +1705,7 @@ void get_index_field_values(LEX *lex, INDEX_FIELD_VALUES *index_field_values) ...@@ -1705,7 +1705,7 @@ void get_index_field_values(LEX *lex, INDEX_FIELD_VALUES *index_field_values)
case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS: case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_TRIGGERS: case SQLCOM_SHOW_TRIGGERS:
index_field_values->db_value= lex->current_select->db; index_field_values->db_value= lex->select_lex.db;
index_field_values->table_value= wild; index_field_values->table_value= wild;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment