mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-merge-5.1
This commit is contained in:
@@ -773,6 +773,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
|
||||
SELECT_LEX *end, *view_select;
|
||||
LEX *old_lex, *lex;
|
||||
Query_arena *arena, backup;
|
||||
TABLE_LIST *top_view= table->top_table();
|
||||
int res;
|
||||
bool result;
|
||||
DBUG_ENTER("mysql_make_view");
|
||||
@@ -800,6 +801,24 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* check loop via view definition */
|
||||
for (TABLE_LIST *precedent= table->referencing_view;
|
||||
precedent;
|
||||
precedent= precedent->referencing_view)
|
||||
{
|
||||
if (precedent->view_name.length == table->table_name_length &&
|
||||
precedent->view_db.length == table->db_length &&
|
||||
my_strcasecmp(system_charset_info,
|
||||
precedent->view_name.str, table->table_name) == 0 &&
|
||||
my_strcasecmp(system_charset_info,
|
||||
precedent->view_db.str, table->db) == 0)
|
||||
{
|
||||
my_error(ER_VIEW_RECURSIVE, MYF(0),
|
||||
top_view->view_db.str, top_view->view_name.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
For now we assume that tables will not be changed during PS life (it
|
||||
will be TRUE as far as we make new table cache).
|
||||
@@ -898,7 +917,6 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
|
||||
}
|
||||
if (!res && !thd->is_fatal_error)
|
||||
{
|
||||
TABLE_LIST *top_view= table->top_table();
|
||||
TABLE_LIST *view_tables= lex->query_tables;
|
||||
TABLE_LIST *view_tables_tail= 0;
|
||||
TABLE_LIST *tbl;
|
||||
|
||||
Reference in New Issue
Block a user