diff options
author | unknown <gluh@gluh.mysql.r18.ru> | 2005-01-27 11:06:44 +0300 |
---|---|---|
committer | unknown <gluh@gluh.mysql.r18.ru> | 2005-01-27 11:06:44 +0300 |
commit | 7f39357efe2f70b27ea821d0c5ca4951e333c9ac (patch) | |
tree | bac08c3d1788fc9a94b28b7d569d8221fe0f1ffc | |
parent | 9dd5ded124aea4130569c5d412c1e90209b582b9 (diff) | |
download | mariadb-git-7f39357efe2f70b27ea821d0c5ca4951e333c9ac.tar.gz |
Fix after review for
ChangeSet
1.1803 05/01/24
Additional fix for WL#1629: SHOW with WHERE(discussed with PeterG)
-rw-r--r-- | mysql-test/r/ps_1general.result | 12 | ||||
-rw-r--r-- | mysql-test/t/ps_1general.test | 8 | ||||
-rw-r--r-- | sql/sql_base.cc | 12 | ||||
-rw-r--r-- | sql/sql_show.cc | 14 |
4 files changed, 31 insertions, 15 deletions
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index c65d11330ea..f5c71d3ed23 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -264,6 +264,18 @@ prepare stmt4 from ' show tables from test like ''t2%'' '; execute stmt4; Tables_in_test (t2%) t2 +prepare stmt4 from ' show columns from t2 where field in (select ?) '; +SET @arg00="a"; +execute stmt4 using @arg00; +Field Type Null Key Default Extra +a int(11) NO PRI +SET @arg00="b"; +execute stmt4 using @arg00; +Field Type Null Key Default Extra +b char(10) YES NULL +SET @arg00=1; +execute stmt4 using @arg00; +Field Type Null Key Default Extra prepare stmt4 from ' show columns from t2 from test like ''a%'' '; execute stmt4; Field Type Null Key Default Extra diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 4b55593fde5..ed51b820652 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -290,6 +290,14 @@ prepare stmt4 from ' show databases '; execute stmt4; prepare stmt4 from ' show tables from test like ''t2%'' '; execute stmt4; +prepare stmt4 from ' show columns from t2 where field in (select ?) '; +SET @arg00="a"; +execute stmt4 using @arg00; +SET @arg00="b"; +execute stmt4 using @arg00; +SET @arg00=1; +execute stmt4 using @arg00; + prepare stmt4 from ' show columns from t2 from test like ''a%'' '; execute stmt4; create index t2_idx on t2(b); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 0aa9f842691..539744998ff 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2135,8 +2135,18 @@ find_field_in_table(THD *thd, TABLE_LIST *table_list, { if (!my_strcasecmp(system_charset_info, trans[i].name, name)) { + if (table_list->schema_table_reformed) + { + /* + Translation table items are always Item_fields + and fixed already('mysql_schema_table' function). + So we can return ->field. It is used only for + 'show & where' commands. + */ + DBUG_RETURN(((Item_field*) (trans[i].item))->field); + } #ifndef NO_EMBEDDED_ACCESS_CHECKS - if (check_grants_view && !table_list->schema_table_reformed && + if (check_grants_view && check_grant_column(thd, &table_list->grant, table_list->view_db.str, table_list->view_name.str, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b805ab9ac27..fe333b233e0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3207,22 +3207,10 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) { if (!transl->item->fixed && transl->item->fix_fields(thd, table_list, &transl->item)) - { DBUG_RETURN(1); - } - } - if (sel->where && !sel->where->fixed && - sel->where->fix_fields(thd, table_list, &sel->where)) - { - DBUG_RETURN(1); - } - for (transl= table_list->field_translation; transl < end; transl++) - { - transl->item->rename((char *)transl->name); } DBUG_RETURN(0); } - List_iterator_fast<Item> it(sel->item_list); if (!(transl= (Field_translator*)(thd->current_arena-> @@ -3236,9 +3224,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) char *name= item->name; transl[i].item= item; if (!item->fixed && item->fix_fields(thd, table_list, &transl[i].item)) - { DBUG_RETURN(1); - } transl[i++].name= name; } table_list->field_translation= transl; |