summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-03-02 00:09:22 +0300
committerunknown <evgen@moonbone.local>2007-03-02 00:09:22 +0300
commit1437a9c532df2ff1f7dc5d72fdc50cdb89014c90 (patch)
treebb27187d840f1f915575ee30f0eb1dc6458b204e /sql/sql_insert.cc
parent6d537f01fd7b7cf97ae019aef03f1ed305bcb5fd (diff)
downloadmariadb-git-1437a9c532df2ff1f7dc5d72fdc50cdb89014c90.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. sql/mysql_priv.h: Bug#25122: Views based on a self-joined table aren't insertable. Updated prototype of the unique_table() function. sql/sql_base.cc: Bug#25122: Views based on a self-joined table aren't insertable. Now the unique_table() function checks tables' aliases when needed. sql/sql_delete.cc: Bug#25122: Views based on a self-joined table aren't insertable. Updated calls to the unique_table() function. sql/sql_insert.cc: Bug#25122: Views based on a self-joined table aren't insertable. Updated calls to the unique_table() function. sql/sql_load.cc: Bug#25122: Views based on a self-joined table aren't insertable. Updated calls to the unique_table() function. sql/sql_parse.cc: Bug#25122: Views based on a self-joined table aren't insertable. Updated calls to the unique_table() function. sql/sql_update.cc: Bug#25122: Views based on a self-joined table aren't insertable. Updated calls to the unique_table() function.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc4
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;