diff options
author | evgen@moonbone.local <> | 2007-03-02 00:09:22 +0300 |
---|---|---|
committer | evgen@moonbone.local <> | 2007-03-02 00:09:22 +0300 |
commit | 11588e5e4a64f01485fce6d5b566d47ef7d6b824 (patch) | |
tree | bb27187d840f1f915575ee30f0eb1dc6458b204e /sql/sql_insert.cc | |
parent | 8f52c5b2070f4ebd8ac3edd395451baa95661f8a (diff) | |
download | mariadb-git-11588e5e4a64f01485fce6d5b566d47ef7d6b824.tar.gz |
Bug#25122: Views based on a self-joined table aren't insertable.
When INSERT is done over a view the table being inserted into is
checked to be unique among all views tables. But if the view contains
self-joined table an error will be thrown even if all tables are used under
different aliases.
The unique_table() function now also checks tables' aliases when needed.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 332c4c82ba1..55c9d2e6882 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1044,7 +1044,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, { Item *fake_conds= 0; TABLE_LIST *duplicate; - if ((duplicate= unique_table(thd, table_list, table_list->next_global))) + if ((duplicate= unique_table(thd, table_list, table_list->next_global, 1))) { update_non_unique_table_error(table_list, "INSERT", duplicate); DBUG_RETURN(TRUE); @@ -2424,7 +2424,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) query */ if (!(lex->current_select->options & OPTION_BUFFER_RESULT) && - unique_table(thd, table_list, table_list->next_global)) + unique_table(thd, table_list, table_list->next_global, 0)) { /* Using same table for INSERT and SELECT */ lex->current_select->options|= OPTION_BUFFER_RESULT; |