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.1967 05/11/11 13:39:46 gluh@stripped +3 -0
Fix for bug#13818 SHOW CREATE VIEW / TABLE and information_schema.views fail
for invalid view
Permit SHOW CREATE VIEW, SHOW CREATE TABLE, and retrieval of metadata from
information_schema for invalid views
sql/sql_show.cc
1.296 05/11/11 13:38:29 gluh@stripped +46 -35
Fix for bug#13818 SHOW CREATE VIEW / TABLE and information_schema.views fail
for invalid view
Permit SHOW CREATE VIEW, SHOW CREATE TABLE, and retrieval of metadata from
information_schema for invalid views
mysql-test/t/information_schema.test
1.62 05/11/11 13:38:29 gluh@stripped +2 -0
Fix for bug#13818 SHOW CREATE VIEW / TABLE and information_schema.views fail
for invalid view
test case
mysql-test/r/information_schema.result
1.89 05/11/11 13:38:29 gluh@stripped +14 -0
Fix for bug#13818 SHOW CREATE VIEW / TABLE and information_schema.views fail
for invalid view
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/Merge/5.0
--- 1.295/sql/sql_show.cc Fri Nov 11 04:25:17 2005
+++ 1.296/sql/sql_show.cc Fri Nov 11 13:38:29 2005
@@ -362,7 +362,21 @@
/* Only one table for now, but VIEW can involve several tables */
if (open_normal_and_derived_tables(thd, table_list, 0))
- DBUG_RETURN(TRUE);
+ {
+ if (!table_list->view || thd->net.last_errno != ER_VIEW_INVALID)
+ DBUG_RETURN(TRUE);
+ /*
+ Clear all messages with 'error' level status and
+ issue a warning with 'warning' level status in
+ case of invalid view and last error is ER_VIEW_INVALID
+ */
+ mysql_reset_errors(thd, true);
+ push_warning_printf(thd,MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_VIEW_INVALID,
+ ER(ER_VIEW_INVALID),
+ table_list->view_db.str,
+ table_list->view_name.str);
+ }
/* TODO: add environment variables show when it become possible */
if (thd->lex->only_view && !table_list->view)
@@ -2992,47 +3006,44 @@
DBUG_ENTER("get_schema_views_record");
char definer[HOSTNAME_LENGTH + USERNAME_LENGTH + 2];
uint definer_len;
- if (!res)
- {
- if (tables->view)
- {
- restore_record(table, s->default_values);
- table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
- table->field[2]->store(tables->view_name.str, tables->view_name.length,
- cs);
- table->field[3]->store(tables->query.str, tables->query.length, cs);
- if (tables->with_check != VIEW_CHECK_NONE)
- {
- if (tables->with_check == VIEW_CHECK_LOCAL)
- table->field[4]->store(STRING_WITH_LEN("LOCAL"), cs);
- else
- table->field[4]->store(STRING_WITH_LEN("CASCADED"), cs);
- }
- else
- table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
+ if (tables->view)
+ {
+ restore_record(table, s->default_values);
+ table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
+ table->field[2]->store(tables->view_name.str, tables->view_name.length,
+ cs);
+ table->field[3]->store(tables->query.str, tables->query.length, cs);
- if (tables->updatable_view)
- table->field[5]->store(STRING_WITH_LEN("YES"), cs);
- else
- table->field[5]->store(STRING_WITH_LEN("NO"), cs);
- definer_len= (strxmov(definer, tables->definer.user.str, "@",
- tables->definer.host.str, NullS) - definer);
- table->field[6]->store(definer, definer_len, cs);
- if (tables->view_suid)
- table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs);
+ if (tables->with_check != VIEW_CHECK_NONE)
+ {
+ if (tables->with_check == VIEW_CHECK_LOCAL)
+ table->field[4]->store(STRING_WITH_LEN("LOCAL"), cs);
else
- table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs);
- DBUG_RETURN(schema_table_store_record(thd, table));
+ table->field[4]->store(STRING_WITH_LEN("CASCADED"), cs);
}
- }
- else
- {
- if (tables->view)
+ else
+ table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
+
+ if (tables->updatable_view)
+ table->field[5]->store(STRING_WITH_LEN("YES"), cs);
+ else
+ table->field[5]->store(STRING_WITH_LEN("NO"), cs);
+ definer_len= (strxmov(definer, tables->definer.user.str, "@",
+ tables->definer.host.str, NullS) - definer);
+ table->field[6]->store(definer, definer_len, cs);
+ if (tables->view_suid)
+ table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs);
+ else
+ table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
+ if (res)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
- thd->clear_error();
}
+ if (res)
+ thd->clear_error();
DBUG_RETURN(0);
}
--- 1.88/mysql-test/r/information_schema.result Thu Nov 10 23:24:50 2005
+++ 1.89/mysql-test/r/information_schema.result Fri Nov 11 13:38:29 2005
@@ -647,12 +647,16 @@
select table_name from information_schema.views
where table_schema='test';
table_name
+v2
+v3
Warnings:
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select table_name from information_schema.views
where table_schema='test';
table_name
+v2
+v3
Warnings:
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
@@ -669,6 +673,16 @@
select constraint_name from information_schema.table_constraints
where table_schema='test';
constraint_name
+show create view v2;
+View Create View
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `test`.`t1`.`f1` AS `c` from `t1`
+Warnings:
+Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+show create table v3;
+View Create View
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select sql_no_cache `test`.`sub1`(1) AS `c`
+Warnings:
+Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v2;
drop view v3;
drop table t4;
--- 1.61/mysql-test/t/information_schema.test Fri Oct 28 14:00:48 2005
+++ 1.62/mysql-test/t/information_schema.test Fri Nov 11 13:38:29 2005
@@ -379,6 +379,8 @@
select index_name from information_schema.statistics where table_schema='test';
select constraint_name from information_schema.table_constraints
where table_schema='test';
+show create view v2;
+show create table v3;
drop view v2;
drop view v3;
drop table t4;
| Thread |
|---|
| • bk commit into 5.0 tree (gluh:1.1967) BUG#13818 | gluh | 11 Nov |