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.2028 05/10/25 13:15:45 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.294 05/10/25 13:14:11 gluh@stripped +42 -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.61 05/10/25 13:14:11 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.86 05/10/25 13:14:11 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/Bugs/5.0.13818
--- 1.293/sql/sql_show.cc Tue Oct 18 17:22:59 2005
+++ 1.294/sql/sql_show.cc Tue Oct 25 13:14:11 2005
@@ -359,7 +359,17 @@
/* 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)
+ DBUG_RETURN(TRUE);
+ /* issue a warning in case of invalid view */
+ 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)
@@ -2966,47 +2976,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.85/mysql-test/r/information_schema.result Fri Oct 21 13:14:45 2005
+++ 1.86/mysql-test/r/information_schema.result Tue Oct 25 13:14:11 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)
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
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)
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
@@ -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)
+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)
drop view v2;
drop view v3;
drop table t4;
--- 1.60/mysql-test/t/information_schema.test Fri Oct 21 13:14:45 2005
+++ 1.61/mysql-test/t/information_schema.test Tue Oct 25 13:14:11 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.2028) BUG#13818 | gluh | 25 Oct |