summaryrefslogtreecommitdiff
path: root/sql/sql_update.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_update.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_update.cc')
-rw-r--r--sql/sql_update.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 1db77f8704c..b20e3689f64 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -636,7 +636,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
/* Check that we are not using table that we are updating in a sub select */
{
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, 0)))
{
update_non_unique_table_error(table_list, "UPDATE", duplicate);
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
@@ -863,7 +863,7 @@ reopen_tables:
tl->lock_type != TL_READ_NO_INSERT)
{
TABLE_LIST *duplicate;
- if ((duplicate= unique_table(thd, tl, table_list)))
+ if ((duplicate= unique_table(thd, tl, table_list, 0)))
{
update_non_unique_table_error(table_list, "UPDATE", duplicate);
DBUG_RETURN(TRUE);
@@ -1082,7 +1082,7 @@ static bool safe_update_on_fly(THD *thd, JOIN_TAB *join_tab,
List<Item> *fields)
{
TABLE *table= join_tab->table;
- if (unique_table(thd, table_ref, all_tables))
+ if (unique_table(thd, table_ref, all_tables, 0))
return 0;
switch (join_tab->type) {
case JT_SYSTEM: