summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2005-08-17 22:19:12 -0700
committerigor@rurik.mysql.com <>2005-08-17 22:19:12 -0700
commit5ac7d86793cdc0a503b6c46698ec9a3345fd2a77 (patch)
tree8ba32cb278ce9e2b0330258b913bfffea7be1708 /sql/sql_view.cc
parent7b3ae86a81664c051d1278bbe34ded5e0c8e16df (diff)
downloadmariadb-git-5ac7d86793cdc0a503b6c46698ec9a3345fd2a77.tar.gz
view.test:
Added a test case for bug #10970. view.result: Added a test case for bug #10970. Modified the error messages for error ER_VIEW_SELECT_TMPTABLE. sql_view.cc: Fixed bug #10970. In the function mysql_create_view if a view does not refer any tables directly the variable table must be updated after the call of open_and_lock_tables. errmsg.txt: Modified the error messages for error ER_VIEW_SELECT_TMPTABLE (when fixing bug #10970).
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index c3222f951bb..ddc47d26a69 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -310,9 +310,11 @@ bool mysql_create_view(THD *thd,
/*
check that tables are not temporary and this VIEW do not used in query
- (it is possible with ALTERing VIEW)
- */
- for (tbl= tables; tbl; tbl= tbl->next_global)
+ (it is possible with ALTERing VIEW).
+ open_and_lock_tables can change the value of tables,
+ e.g. it may happen if before the function call tables was equal to 0.
+ */
+ for (tbl= tables= lex->query_tables; tbl; tbl= tbl->next_global)
{
/* is this table temporary and is not view? */
if (tbl->table->s->tmp_table != NO_TMP_TABLE && !tbl->view &&