Commit 7f39357e authored by unknown's avatar unknown
Browse files

Fix after review for

ChangeSet
  1.1803 05/01/24
  Additional fix for WL#1629: SHOW with WHERE(discussed with PeterG) 

parent 9dd5ded1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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);
+11 −1
Original line number Diff line number Diff line
@@ -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,
+0 −14
Original line number Diff line number Diff line
@@ -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;