MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:gluh Date:September 6 2005 10:06am
Subject:bk commit into 5.0 tree (gluh:1.1959) BUG#12905
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1959 05/09/06 15:06:34 gluh@stripped +3 -0
  Fix for bug#12905 show fields from view behaving erratically with current database
    use saved view db name in case of view

  sql/sql_show.cc
    1.274 05/09/06 15:06:29 gluh@stripped +19 -2
    Fix for bug#12905 show fields from view behaving erratically with current database
      use saved view db name in case of view

  mysql-test/t/information_schema.test
    1.56 05/09/06 15:06:28 gluh@stripped +13 -1
    Fix for bug#12905 show fields from view behaving erratically with current database
      test case

  mysql-test/r/information_schema.result
    1.79 05/09/06 15:06:28 gluh@stripped +11 -0
    Fix for bug#12905 show fields from view behaving erratically with current database
      test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.0.12905

--- 1.273/sql/sql_show.cc	Fri Sep  2 18:21:08 2005
+++ 1.274/sql/sql_show.cc	Tue Sep  6 15:06:29 2005
@@ -1988,10 +1988,20 @@
     /*
       get_all_tables() returns 1 on failure and 0 on success thus
       return only these and not the result code of ::process_table()
+
+      We should use show_table_list->alias instead of 
+      show_table_list->table_name because table_name
+      could be changed during opening of I_S tables. It's safe
+      to use alias because alias contains original table name 
+      in this case(this part of code is used only for 
+      'show columns' & 'show statistics' commands).
     */
     error= test(schema_table->process_table(thd, show_table_list,
-                                    table, res, show_table_list->db,
-                                    show_table_list->alias));
+                                            table, res, 
+                                            (show_table_list->view ?
+                                             show_table_list->view_db.str :
+                                             show_table_list->db),
+                                            show_table_list->alias));
     close_thread_tables(thd);
     show_table_list->table= 0;
     goto err;
@@ -2092,6 +2102,13 @@
             lex->derived_tables= 0;
             res= open_normal_and_derived_tables(thd, show_table_list,
                                                 MYSQL_LOCK_IGNORE_FLUSH);
+            /*
+              We should use show_table_list->alias instead of 
+              show_table_list->table_name because table_name
+              could be changed during opening of I_S tables. It's safe
+              to use alias because alias contains original table name 
+              in this case.
+            */
             res= schema_table->process_table(thd, show_table_list, table,
                                             res, base_name,
                                             show_table_list->alias);

--- 1.78/mysql-test/r/information_schema.result	Sat Aug 27 15:29:29 2005
+++ 1.79/mysql-test/r/information_schema.result	Tue Sep  6 15:06:28 2005
@@ -979,3 +979,14 @@
 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		
+DROP TABLE t1,t2;
+create table t1(f1 int);
+create view v1 (c) as select f1 from t1;
+select database();
+database()
+NULL
+show fields from test.v1;
+Field	Type	Null	Key	Default	Extra
+c	int(11)	YES		NULL	
+drop view v1;
+drop table t1;

--- 1.55/mysql-test/t/information_schema.test	Thu Sep  1 23:02:04 2005
+++ 1.56/mysql-test/t/information_schema.test	Tue Sep  6 15:06:28 2005
@@ -665,4 +665,16 @@
   WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
                     WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
 
-DROP TABLE t1,t2
+DROP TABLE t1,t2;
+
+#
+# Bug #12905 show fields from view behaving erratically with current database
+#
+create table t1(f1 int);
+create view v1 (c) as select f1 from t1;
+connect (con5,localhost,root,,*NO-ONE*);
+select database();
+show fields from test.v1;
+connection default;
+drop view v1;
+drop table t1;
Thread
bk commit into 5.0 tree (gluh:1.1959) BUG#12905gluh6 Sep