summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-02-25 16:18:24 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-02-25 16:18:24 +0400
commit89fbca28135f6e0bc4998381c08a9028f671ca1d (patch)
tree78432ddf9a28f4d3cc0d72eee420edd6979efd1d /sql
parentda3c4375cfe9530c04525ff6694e5f59f354c144 (diff)
parent5d2fc5335411bdd05a08a9b062d3441d4308dcaa (diff)
downloadmariadb-git-89fbca28135f6e0bc4998381c08a9028f671ca1d.tar.gz
5.0-bugteam->5.1-bugteam merge
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_show.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 71fd79b597a..942b131b301 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -287,7 +287,7 @@ static struct show_privileges_st sys_privileges[]=
{"Alter", "Tables", "To alter the table"},
{"Alter routine", "Functions,Procedures", "To alter or drop stored functions/procedures"},
{"Create", "Databases,Tables,Indexes", "To create new databases and tables"},
- {"Create routine","Functions,Procedures","To use CREATE FUNCTION/PROCEDURE"},
+ {"Create routine","Databases","To use CREATE FUNCTION/PROCEDURE"},
{"Create temporary tables","Databases","To use CREATE TEMPORARY TABLE"},
{"Create view", "Tables", "To create new views"},
{"Create user", "Server Admin", "To create new users"},
@@ -1598,21 +1598,25 @@ void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
int
view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
{
+ my_bool compact_view_name= TRUE;
my_bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
MODE_ORACLE |
MODE_MSSQL |
MODE_DB2 |
MODE_MAXDB |
MODE_ANSI)) != 0;
- /*
- Compact output format for view can be used
- - if user has db of this view as current db
- - if this view only references table inside it's own db
- */
+
if (!thd->db || strcmp(thd->db, table->view_db.str))
- table->compact_view_format= FALSE;
+ /*
+ print compact view name if the view belongs to the current database
+ */
+ compact_view_name= table->compact_view_format= FALSE;
else
{
+ /*
+ Compact output format for view body can be used
+ if this view only references table inside it's own db
+ */
TABLE_LIST *tbl;
table->compact_view_format= TRUE;
for (tbl= thd->lex->query_tables;
@@ -1633,7 +1637,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
view_store_options(thd, table, buff);
}
buff->append(STRING_WITH_LEN("VIEW "));
- if (!table->compact_view_format)
+ if (!compact_view_name)
{
append_identifier(thd, buff, table->view_db.str, table->view_db.length);
buff->append('.');