Below is the list of changes that have just been committed into a local
5.0 repository of tnurnberg. When tnurnberg 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@stripped, 2007-10-26 09:01:29+02:00, tnurnberg@stripped +2 -0
Bug#31662: 'null' is shown as type of fields for view with bad definer, breaks mysqldump
SHOW FIELDS FROM a view with no valid definer was possible (since fix
for Bug#26817), but gave NULL as a field-type. This led to mysqldump-ing
of such views being successful, but loading such a dump with the client
failing. Patch allows SHOW FIELDS to give data-type of field in underlying
table.
mysql-test/r/information_schema_db.result@stripped, 2007-10-26 09:01:28+02:00, tnurnberg@stripped +3 -3
Fix test results: SHOW FIELDS FROM a view with no valid DEFINER
gives us the field-type of the underlying table now rather than NULL.
sql/sql_base.cc@stripped, 2007-10-26 09:01:28+02:00, tnurnberg@stripped +3 -1
In the case of SHOW FIELDS FROM <view>, do not require a valid
DEFINER for determining underlying data-type like we usually do.
This is needed for mysqldump.
diff -Nrup a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
--- a/mysql-test/r/information_schema_db.result 2007-08-20 08:23:06 +02:00
+++ b/mysql-test/r/information_schema_db.result 2007-10-26 09:01:28 +02:00
@@ -130,7 +130,7 @@ Warnings:
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
show fields from testdb_1.v7;
Field Type Null Key Default Extra
-f1 null YES NULL
+f1 char(4) YES NULL
Warnings:
Note 1449 There is no 'no_such_user'@'no_such_host' registered
create table t3 (f1 char(4), f2 char(4));
@@ -150,7 +150,7 @@ View Create View
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
show fields from testdb_1.v7;
Field Type Null Key Default Extra
-f1 null YES NULL
+f1 char(4) YES NULL
Warnings:
Note 1449 There is no 'no_such_user'@'no_such_host' registered
show create view testdb_1.v7;
@@ -178,7 +178,7 @@ show create view v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v4;
Field Type Null Key Default Extra
-f1 null YES NULL
+f1 char(4) YES NULL
f2 char(4) YES NULL
show fields from v2;
Field Type Null Key Default Extra
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc 2007-09-27 11:17:13 +02:00
+++ b/sql/sql_base.cc 2007-10-26 09:01:28 +02:00
@@ -3958,7 +3958,9 @@ find_field_in_tables(THD *thd, Item_iden
{
Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
item->name, db, table_name, ref,
- check_privileges,
+ (thd->lex->sql_command ==
+ SQLCOM_SHOW_FIELDS)
+ ? false : check_privileges,
allow_rowid,
&(item->cached_field_index),
register_tree_change,