diff options
author | Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com> | 2012-03-14 06:27:03 +0530 |
---|---|---|
committer | Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com> | 2012-03-14 06:27:03 +0530 |
commit | e48afab412a952e17d499769b15b94e36dc4979a (patch) | |
tree | 60434e05b2bd9923b505fb4e69dc07b6361fea64 /sql/sql_view.cc | |
parent | 4977b60e597d05581126293054f8d8a2f1cd072c (diff) | |
download | mariadb-git-e48afab412a952e17d499769b15b94e36dc4979a.tar.gz |
Bug#12626844 : WE ARE NOT CHECKING VIEW TABLE NAMES
ENOUGH - CONCAT() HACKS. ALSO WRONG
ERROR MESSAGE WHILE TRYING TO CREATE
A VIEW ON A NON EXISTING DATABASE
PROBLEM:
The first part of the problem is concluded as not a
bug, as 'concat' is not a reserved word and it is
completely valid to create a view with the name
'concat'.
The second issue is, while trying to create a view on
a non existing database, we are not giving a proper error
message.
FIX:
We have added a check for the database existence while
trying to create a view. This check would give an error
as 'unknown database' when the database does not exist.
This patch is a backport of the patch for Bug#13601606
mysql-test/r/view.result:
Added test case result of Bug#12626844
mysql-test/t/view.test:
Added test case for Bug#12626844
sql/sql_view.cc:
Added a check for database existence in mysql_create_view
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 1d26d2b113c..24cb0dd3e8d 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -444,6 +444,13 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, view= lex->unlink_first_table(&link_to_local); + if (check_db_dir_existence(view->db)) + { + my_error(ER_BAD_DB_ERROR, MYF(0), view->db); + res= TRUE; + goto err; + } + if (mode == VIEW_ALTER && fill_defined_view_parts(thd, view)) { res= TRUE; |