List:Internals« Previous MessageNext Message »
From:sanja Date:June 24 2005 6:21pm
Subject:bk commit into 5.0 tree (bell:1.2007) BUG#10773
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2007 05/06/24 21:21:48 bell@stripped +14 -0
  issue correct error message in case of view presence for duplicated table on update (BUG#10773)
  frequantly used command sequance replaced with inline function

  sql/table.h
    1.101 05/06/24 21:21:43 bell@stripped +2 -0
    frequantly used command sequance replaced with inline function

  sql/table.cc
    1.173 05/06/24 21:21:43 bell@stripped +1 -1
    frequantly used command sequance replaced with inline function

  sql/sql_view.cc
    1.49 05/06/24 21:21:43 bell@stripped +2 -5
    frequantly used command sequance replaced with inline function

  sql/sql_update.cc
    1.161 05/06/24 21:21:43 bell@stripped +15 -8
    issue correct error message in case of view presence for duplicated table on update

  sql/sql_parse.cc
    1.459 05/06/24 21:21:43 bell@stripped +11 -7
    issue correct error message in case of view presence for duplicated table on update

  sql/sql_insert.cc
    1.164 05/06/24 21:21:43 bell@stripped +7 -3
    issue correct error message in case of view presence for duplicated table on update

  sql/sql_delete.cc
    1.153 05/06/24 21:21:43 bell@stripped +14 -7
    issue correct error message in case of view presence for duplicated table on update

  sql/sql_base.cc
    1.259 05/06/24 21:21:43 bell@stripped +36 -3
    subroutine which issue correct error message in case of view presence for duplicated table on update

  sql/share/errmsg.txt
    1.35 05/06/24 21:21:42 bell@stripped +2 -0
    new error message

  sql/mysql_priv.h
    1.319 05/06/24 21:21:42 bell@stripped +3 -0
    subroutine which return correct error message

  mysql-test/t/view.test
    1.75 05/06/24 21:21:42 bell@stripped +60 -45
    hided view underlying tables from error message

  mysql-test/t/lowercase_view.test
    1.6 05/06/24 21:21:42 bell@stripped +43 -43
    hided view underlying tables from error message

  mysql-test/r/view.result
    1.87 05/06/24 21:21:42 bell@stripped +55 -45
    hided view underlying tables from error message

  mysql-test/r/lowercase_view.result
    1.8 05/06/24 21:21:42 bell@stripped +49 -49
    hided view underlying tables from error message

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bell
# Host:	sanja.is.com.ua
# Root:	/home/bell/mysql/bk/work-bug3-5.0

--- 1.318/sql/mysql_priv.h	Tue Jun 21 17:18:22 2005
+++ 1.319/sql/mysql_priv.h	Fri Jun 24 21:21:42 2005
@@ -882,6 +882,9 @@
 void add_join_natural(TABLE_LIST *a,TABLE_LIST *b);
 bool add_proc_to_list(THD *thd, Item *item);
 TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
+void update_non_unique_table_error(TABLE_LIST *update,
+                                   const char *operation,
+                                   TABLE_LIST *duplicate);
 
 SQL_SELECT *make_select(TABLE *head, table_map const_tables,
 			table_map read_tables, COND *conds,

--- 1.258/sql/sql_base.cc	Thu Jun 23 02:25:25 2005
+++ 1.259/sql/sql_base.cc	Fri Jun 24 21:21:43 2005
@@ -775,6 +775,41 @@
 }
 
 
+/*
+  Issue correct error message in case we found 2 duplicate tables which
+  porevent some update operation
+
+  SYNOPSIS
+    update_non_unique_table_error()
+    update      table which we try to update
+    operation   name of update operation
+    duplicate   duplicate table which we found
+
+  NOTE:
+    here we hide view underlying tables if we have them
+*/
+
+void update_non_unique_table_error(TABLE_LIST *update,
+                                   const char *operation,
+                                   TABLE_LIST *duplicate)
+{
+  update= update->top_table();
+  if (update->view)
+  {
+    my_error(ER_NON_UPDATABLE_TABLE, MYF(0), update->alias, operation);
+    return;
+  }
+  duplicate= duplicate->top_table();
+  if (duplicate->view)
+  {
+    my_error(ER_VIEW_PREVENT_UPDATE, MYF(0), duplicate->alias, operation,
+             update->alias);
+    return;
+  }
+  my_error(ER_UPDATE_TABLE_USED, MYF(0), update->alias);
+}
+
+
 TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name)
 {
   char	key[MAX_DBKEY_LENGTH];
@@ -3212,9 +3247,7 @@
   {
     TABLE *table= table_list->table;
     if (first_select_table &&
-        (table_list->belong_to_view ?
-         table_list->belong_to_view :
-         table_list) == first_select_table)
+        table_list->top_table() == first_select_table)
     {
       /* new counting for SELECT of INSERT ... SELECT command */
       first_select_table= 0;

--- 1.152/sql/sql_delete.cc	Sat Jun 18 00:14:28 2005
+++ 1.153/sql/sql_delete.cc	Fri Jun 24 21:21:43 2005
@@ -309,10 +309,13 @@
     my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
     DBUG_RETURN(TRUE);
   }
-  if (unique_table(table_list, table_list->next_global))
   {
-    my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
-    DBUG_RETURN(TRUE);
+    TABLE_LIST *duplicate;
+    if ((duplicate= unique_table(table_list, table_list->next_global)))
+    {
+      update_non_unique_table_error(table_list, "DELETE", duplicate);
+      DBUG_RETURN(TRUE);
+    }
   }
   select_lex->fix_prepare_information(thd, conds);
   DBUG_RETURN(FALSE);
@@ -393,11 +396,15 @@
       Check that table from which we delete is not used somewhere
       inside subqueries/view.
     */
-    if (unique_table(target_tbl->correspondent_table, lex->query_tables))
     {
-      my_error(ER_UPDATE_TABLE_USED, MYF(0),
-               target_tbl->correspondent_table->table_name);
-      DBUG_RETURN(TRUE);
+      TABLE_LIST *duplicate;
+      if ((duplicate= unique_table(target_tbl->correspondent_table,
+                                   lex->query_tables)))
+      {
+        update_non_unique_table_error(target_tbl->correspondent_table,
+                                      "DELETE", duplicate);
+        DBUG_RETURN(TRUE);
+      }
     }
   }
   DBUG_RETURN(FALSE);

--- 1.163/sql/sql_insert.cc	Wed Jun 22 20:07:26 2005
+++ 1.164/sql/sql_insert.cc	Fri Jun 24 21:21:43 2005
@@ -778,10 +778,14 @@
   if (!table)
     table= table_list->table;
 
-  if (!select_insert && unique_table(table_list, table_list->next_global))
+  if (!select_insert)
   {
-    my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
-    DBUG_RETURN(TRUE);
+    TABLE_LIST *duplicate;
+    if ((duplicate= unique_table(table_list, table_list->next_global)))
+    {
+      update_non_unique_table_error(table_list, "INSERT", duplicate);
+      DBUG_RETURN(TRUE);
+    }
   }
   if (duplic == DUP_UPDATE || duplic == DUP_REPLACE)
     table->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY);

--- 1.458/sql/sql_parse.cc	Thu Jun 23 00:02:41 2005
+++ 1.459/sql/sql_parse.cc	Fri Jun 24 21:21:43 2005
@@ -2845,12 +2845,15 @@
           Is table which we are changing used somewhere in other parts
           of query
         */
-        if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
-            unique_table(create_table, select_tables))
+        if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
         {
-          my_error(ER_UPDATE_TABLE_USED, MYF(0), create_table->table_name);
-          res= 1;
-          goto end_with_restart_wait;
+          TABLE_LIST *duplicate;
+          if ((duplicate= unique_table(create_table, select_tables)))
+          {
+            update_non_unique_table_error(create_table, "CREATE", duplicate);
+            res= 1;
+            goto end_with_restart_wait;
+          }
         }
         /* If we create merge table, we have to test tables in merge, too */
         if (lex->create_info.used_fields & HA_CREATE_USED_UNION)
@@ -2860,9 +2863,10 @@
                tab;
                tab= tab->next_local)
           {
-            if (unique_table(tab, select_tables))
+            TABLE_LIST *duplicate;
+            if ((duplicate= unique_table(tab, select_tables)))
             {
-              my_error(ER_UPDATE_TABLE_USED, MYF(0), tab->table_name);
+              update_non_unique_table_error(tab, "CREATE", duplicate);
               res= 1;
               goto end_with_restart_wait;
             }

--- 1.160/sql/sql_update.cc	Wed Jun  1 16:35:04 2005
+++ 1.161/sql/sql_update.cc	Fri Jun 24 21:21:43 2005
@@ -566,10 +566,14 @@
     DBUG_RETURN(TRUE);
 
   /* Check that we are not using table that we are updating in a sub select */
-  if (unique_table(table_list, table_list->next_global))
   {
-    my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
-    DBUG_RETURN(TRUE);
+    TABLE_LIST *duplicate;
+    if ((duplicate= unique_table(table_list, table_list->next_global)))
+    {
+      update_non_unique_table_error(table_list, "UPDATE", duplicate);
+      my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
+      DBUG_RETURN(TRUE);
+    }
   }
   select_lex->fix_prepare_information(thd, conds);
   DBUG_RETURN(FALSE);
@@ -781,7 +785,7 @@
   {
     TABLE *table= tl->table;
     TABLE_LIST *tlist;
-    if (!(tlist= tl->belong_to_view ? tl->belong_to_view : tl)->derived)
+    if (!(tlist= tl->top_table())->derived)
     {
       tlist->grant.want_privilege=
         (SELECT_ACL & ~tlist->grant.privilege);
@@ -790,11 +794,14 @@
     DBUG_PRINT("info", ("table: %s  want_privilege: %u", tl->alias,
                         (uint) table->grant.want_privilege));
     if (tl->lock_type != TL_READ &&
-        tl->lock_type != TL_READ_NO_INSERT &&
-        unique_table(tl, table_list))
+        tl->lock_type != TL_READ_NO_INSERT)
     {
-      my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
-      DBUG_RETURN(TRUE);
+      TABLE_LIST *duplicate;
+      if ((duplicate= unique_table(tl, table_list)))
+      {
+        update_non_unique_table_error(table_list, "UPDATE", duplicate);
+        DBUG_RETURN(TRUE);
+      }
     }
   }
 

--- 1.172/sql/table.cc	Wed Jun 22 12:08:22 2005
+++ 1.173/sql/table.cc	Fri Jun 24 21:21:43 2005
@@ -2118,7 +2118,7 @@
 {
   if (check_option && check_option->val_int() == 0)
   {
-    TABLE_LIST *view= (belong_to_view ? belong_to_view : this);
+    TABLE_LIST *view= top_table();
     if (ignore_failure)
     {
       push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,

--- 1.100/sql/table.h	Wed Jun  1 16:35:04 2005
+++ 1.101/sql/table.h	Fri Jun 24 21:21:43 2005
@@ -459,6 +459,8 @@
                           st_table_list *view);
   bool set_insert_values(MEM_ROOT *mem_root);
   st_table_list *find_underlying_table(TABLE *table);
+  inline st_table_list *top_table()
+    { return belong_to_view ? belong_to_view : this; }
 } TABLE_LIST;
 
 class Item;

--- 1.34/sql/share/errmsg.txt	Mon Jun 20 14:38:09 2005
+++ 1.35/sql/share/errmsg.txt	Fri Jun 24 21:21:42 2005
@@ -5358,3 +5358,5 @@
 	eng "The statement (%lu) has no open cursor."
 ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
         eng "Explicit or implicit commit is not allowed in stored function or trigger."
+ER_VIEW_PREVENT_UPDATE
+        eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'."

--- 1.7/mysql-test/r/lowercase_view.result	Mon Mar 28 15:12:28 2005
+++ 1.8/mysql-test/r/lowercase_view.result	Fri Jun 24 21:21:42 2005
@@ -16,103 +16,103 @@
 create view v2aA as select * from v1aA;
 create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
 update v2aA set col1 = (select max(col1) from v1Aa);
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the UPDATE is not updatable
 update v2Aa set col1 = (select max(col1) from t1Aa);
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the UPDATE is not updatable
 update v2aA set col1 = (select max(col1) from v2Aa);
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the UPDATE is not updatable
 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the UPDATE is not updatable
 update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't1aA'.
 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v1aa' for update in FROM clause
+ERROR HY000: The target table v1aA of the UPDATE is not updatable
 update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'.
 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't2Aa'.
 update t2Aa,v1aA set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'.
 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the UPDATE is not updatable
 update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause
 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v1aa' for update in FROM clause
+ERROR HY000: The target table v1aA of the UPDATE is not updatable
 update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause
 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause
 update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from t1Aa) where v1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause
 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the UPDATE is not updatable
 update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't1aA'.
 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v1aa' for update in FROM clause
+ERROR HY000: The target table v1aA of the UPDATE is not updatable
 update t2Aa,v2aA set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'.
 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v2aA) where t1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'.
 update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from v2Aa) where v1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't2aa' for update in FROM clause
+ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 't2Aa'.
 update v3aA set v3Aa.col1 = (select max(col1) from v1aA);
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3aA of the UPDATE is not updatable
 update v3aA set v3Aa.col1 = (select max(col1) from t1aA);
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3aA of the UPDATE is not updatable
 update v3aA set v3Aa.col1 = (select max(col1) from v2aA);
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3aA of the UPDATE is not updatable
 update v3aA set v3Aa.col1 = (select max(col1) from v3aA);
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3aA of the UPDATE is not updatable
 delete from v2Aa where col1 = (select max(col1) from v1Aa);
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the DELETE is not updatable
 delete from v2aA where col1 = (select max(col1) from t1Aa);
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the DELETE is not updatable
 delete from v2Aa where col1 = (select max(col1) from v2aA);
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the DELETE is not updatable
 delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the DELETE is not updatable
 delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 't1Aa'.
 delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v1aa' for update in FROM clause
+ERROR HY000: The target table v1Aa of the DELETE is not updatable
 delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the DELETE is not updatable
 delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause
 delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v1aa' for update in FROM clause
+ERROR HY000: The target table v1Aa of the DELETE is not updatable
 delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the DELETE is not updatable
 delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 't1aA'.
 delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1;
-ERROR HY000: You can't specify target table 'v1aa' for update in FROM clause
+ERROR HY000: The target table v1aA of the DELETE is not updatable
 insert into v2Aa values ((select max(col1) from v1aA));
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the INSERT is not updatable
 insert into t1aA values ((select max(col1) from v1Aa));
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 't1aA'.
 insert into v2aA values ((select max(col1) from v1aA));
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the INSERT is not updatable
 insert into v2Aa values ((select max(col1) from t1Aa));
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the INSERT is not updatable
 insert into t1aA values ((select max(col1) from t1Aa));
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: You can't specify target table 't1aA' for update in FROM clause
 insert into v2aA values ((select max(col1) from t1aA));
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the INSERT is not updatable
 insert into v2Aa values ((select max(col1) from v2aA));
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2Aa of the INSERT is not updatable
 insert into t1Aa values ((select max(col1) from v2Aa));
-ERROR HY000: You can't specify target table 't1aa' for update in FROM clause
+ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'.
 insert into v2aA values ((select max(col1) from v2Aa));
-ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
+ERROR HY000: The target table v2aA of the INSERT is not updatable
 insert into v3Aa (col1) values ((select max(col1) from v1Aa));
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3Aa of the INSERT is not updatable
 insert into v3aA (col1) values ((select max(col1) from t1aA));
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3aA of the INSERT is not updatable
 insert into v3Aa (col1) values ((select max(col1) from v2aA));
-ERROR HY000: You can't specify target table 'v3aa' for update in FROM clause
+ERROR HY000: The target table v3Aa of the INSERT is not updatable
 drop view v3aA,v2Aa,v1aA;
 drop table t1Aa,t2Aa;
 create table t1Aa (col1 int);

--- 1.86/mysql-test/r/view.result	Fri Jun 24 00:24:08 2005
+++ 1.87/mysql-test/r/view.result	Fri Jun 24 21:21:42 2005
@@ -870,29 +870,29 @@
 create view v2 as select * from v1;
 create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
 update v2 set col1 = (select max(col1) from v1);
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the UPDATE is not updatable
 update v2 set col1 = (select max(col1) from t1);
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the UPDATE is not updatable
 update v2 set col1 = (select max(col1) from v2);
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the UPDATE is not updatable
 update v2,t2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the UPDATE is not updatable
 update t1,t2 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'.
 update v1,t2 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v1' for update in FROM clause
+ERROR HY000: The target table v1 of the UPDATE is not updatable
 update t2,v2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't2' for update in FROM clause
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
 update t2,t1 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't2' for update in FROM clause
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
 update t2,v1 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't2' for update in FROM clause
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
 update v2,t2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the UPDATE is not updatable
 update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
 ERROR HY000: You can't specify target table 't1' for update in FROM clause
 update v1,t2 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v1' for update in FROM clause
+ERROR HY000: The target table v1 of the UPDATE is not updatable
 update t2,v2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
 ERROR HY000: You can't specify target table 't2' for update in FROM clause
 update t2,t1 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
@@ -900,75 +900,75 @@
 update t2,v1 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
 ERROR HY000: You can't specify target table 't2' for update in FROM clause
 update v2,t2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the UPDATE is not updatable
 update t1,t2 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't1'.
 update v1,t2 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v1' for update in FROM clause
+ERROR HY000: The target table v1 of the UPDATE is not updatable
 update t2,v2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't2' for update in FROM clause
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'.
 update t2,t1 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't2' for update in FROM clause
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'.
 update t2,v1 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't2' for update in FROM clause
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'.
 update v3 set v3.col1 = (select max(col1) from v1);
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the UPDATE is not updatable
 update v3 set v3.col1 = (select max(col1) from t1);
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the UPDATE is not updatable
 update v3 set v3.col1 = (select max(col1) from v2);
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the UPDATE is not updatable
 update v3 set v3.col1 = (select max(col1) from v3);
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the UPDATE is not updatable
 delete from v2 where col1 = (select max(col1) from v1);
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the DELETE is not updatable
 delete from v2 where col1 = (select max(col1) from t1);
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the DELETE is not updatable
 delete from v2 where col1 = (select max(col1) from v2);
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the DELETE is not updatable
 delete v2 from v2,t2 where (select max(col1) from v1) > 0 and v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the DELETE is not updatable
 delete t1 from t1,t2 where (select max(col1) from v1) > 0 and t1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 't1'.
 delete v1 from v1,t2 where (select max(col1) from v1) > 0 and v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v1' for update in FROM clause
+ERROR HY000: The target table v1 of the DELETE is not updatable
 delete v2 from v2,t2 where (select max(col1) from t1) > 0 and v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the DELETE is not updatable
 delete t1 from t1,t2 where (select max(col1) from t1) > 0 and t1.col1 = t2.col1;
 ERROR HY000: You can't specify target table 't1' for update in FROM clause
 delete v1 from v1,t2 where (select max(col1) from t1) > 0 and v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v1' for update in FROM clause
+ERROR HY000: The target table v1 of the DELETE is not updatable
 delete v2 from v2,t2 where (select max(col1) from v2) > 0 and v2.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the DELETE is not updatable
 delete t1 from t1,t2 where (select max(col1) from v2) > 0 and t1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 't1'.
 delete v1 from v1,t2 where (select max(col1) from v2) > 0 and v1.col1 = t2.col1;
-ERROR HY000: You can't specify target table 'v1' for update in FROM clause
+ERROR HY000: The target table v1 of the DELETE is not updatable
 insert into v2 values ((select max(col1) from v1));
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the INSERT is not updatable
 insert into t1 values ((select max(col1) from v1));
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 't1'.
 insert into v2 values ((select max(col1) from v1));
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the INSERT is not updatable
 insert into v2 values ((select max(col1) from t1));
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the INSERT is not updatable
 insert into t1 values ((select max(col1) from t1));
 ERROR HY000: You can't specify target table 't1' for update in FROM clause
 insert into v2 values ((select max(col1) from t1));
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the INSERT is not updatable
 insert into v2 values ((select max(col1) from v2));
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the INSERT is not updatable
 insert into t1 values ((select max(col1) from v2));
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 't1'.
 insert into v2 values ((select max(col1) from v2));
-ERROR HY000: You can't specify target table 'v2' for update in FROM clause
+ERROR HY000: The target table v2 of the INSERT is not updatable
 insert into v3 (col1) values ((select max(col1) from v1));
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the INSERT is not updatable
 insert into v3 (col1) values ((select max(col1) from t1));
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the INSERT is not updatable
 insert into v3 (col1) values ((select max(col1) from v2));
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the INSERT is not updatable
 insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
-ERROR HY000: You can't specify target table 'v3' for update in FROM clause
+ERROR HY000: The target table v3 of the INSERT is not updatable
 insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
 insert into mysql.time_zone values ('', (select CONVERT_TZ('20050101000000','UTC','MET') from t2));
 ERROR 23000: Column 'Use_leap_seconds' cannot be null
@@ -1327,7 +1327,7 @@
 ERROR HY000: The target table v3 of the INSERT is not updatable
 create view v4 as select * from v2 where 20 < (select (s1) from t1);
 insert into v4 values (30);
-ERROR HY000: You can't specify target table 'v4' for update in FROM clause
+ERROR HY000: The target table v4 of the INSERT is not updatable
 drop view v4, v3, v2, v1;
 drop table t1;
 create table t1 (a int);
@@ -1839,3 +1839,13 @@
 SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1)
 dkjhgd
 drop view v1;
+create table t1 (f59 int, f60 int, f61 int);
+insert into t1 values (19,41,32);
+create view v1 as select f59, f60 from t1 where f59 in  
+(select f59 from t1);
+update v1 set f60=2345;
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+update t1 set f60=(select max(f60) from v1);
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'.
+drop view v1;
+drop table t1;

--- 1.5/mysql-test/t/lowercase_view.test	Mon Mar 28 15:12:28 2005
+++ 1.6/mysql-test/t/lowercase_view.test	Fri Jun 24 21:21:42 2005
@@ -23,29 +23,29 @@
 create view v1Aa as select * from t1aA;
 create view v2aA as select * from v1aA;
 create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v2aA set col1 = (select max(col1) from v1Aa);
--- error 1093
+-- error 1288
 update v2Aa set col1 = (select max(col1) from t1Aa);
--- error 1093
+-- error 1288
 update v2aA set col1 = (select max(col1) from v2Aa);
--- error 1093
+-- error 1288
 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t2Aa,v1aA set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1;
 -- error 1093
 update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1;
 -- error 1093
 update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1;
@@ -53,73 +53,73 @@
 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
 -- error 1093
 update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from t1Aa) where v1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t2Aa,v2aA set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v2aA) where t1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from v2Aa) where v1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 update v3aA set v3Aa.col1 = (select max(col1) from v1aA);
--- error 1093
+-- error 1288
 update v3aA set v3Aa.col1 = (select max(col1) from t1aA);
--- error 1093
+-- error 1288
 update v3aA set v3Aa.col1 = (select max(col1) from v2aA);
--- error 1093
+-- error 1288
 update v3aA set v3Aa.col1 = (select max(col1) from v3aA);
--- error 1093
+-- error 1288
 delete from v2Aa where col1 = (select max(col1) from v1Aa);
--- error 1093
+-- error 1288
 delete from v2aA where col1 = (select max(col1) from t1Aa);
--- error 1093
+-- error 1288
 delete from v2Aa where col1 = (select max(col1) from v2aA);
--- error 1093
+-- error 1288
 delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1;
 -- error 1093
 delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1;
--- error 1093
+-- error 1423
 delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1;
--- error 1093
+-- error 1288
 insert into v2Aa values ((select max(col1) from v1aA));
--- error 1093
+-- error 1423
 insert into t1aA values ((select max(col1) from v1Aa));
--- error 1093
+-- error 1288
 insert into v2aA values ((select max(col1) from v1aA));
--- error 1093
+-- error 1288
 insert into v2Aa values ((select max(col1) from t1Aa));
 -- error 1093
 insert into t1aA values ((select max(col1) from t1Aa));
--- error 1093
+-- error 1288
 insert into v2aA values ((select max(col1) from t1aA));
--- error 1093
+-- error 1288
 insert into v2Aa values ((select max(col1) from v2aA));
--- error 1093
+-- error 1423
 insert into t1Aa values ((select max(col1) from v2Aa));
--- error 1093
+-- error 1288
 insert into v2aA values ((select max(col1) from v2Aa));
--- error 1093
+-- error 1288
 insert into v3Aa (col1) values ((select max(col1) from v1Aa));
--- error 1093
+-- error 1288
 insert into v3aA (col1) values ((select max(col1) from t1aA));
--- error 1093
+-- error 1288
 insert into v3Aa (col1) values ((select max(col1) from v2aA));
 drop view v3aA,v2Aa,v1aA;
 drop table t1Aa,t2Aa;

--- 1.74/mysql-test/t/view.test	Fri Jun 24 00:24:08 2005
+++ 1.75/mysql-test/t/view.test	Fri Jun 24 21:21:42 2005
@@ -827,29 +827,29 @@
 create view v1 as select * from t1;
 create view v2 as select * from v1;
 create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v2 set col1 = (select max(col1) from v1);
--- error 1093
+-- error 1288
 update v2 set col1 = (select max(col1) from t1);
--- error 1093
+-- error 1288
 update v2 set col1 = (select max(col1) from v2);
--- error 1093
+-- error 1288
 update v2,t2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t1,t2 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v1,t2 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t2,v2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t2,t1 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t2,v1 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v2,t2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
 -- error 1093
 update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v1,t2 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
 -- error 1093
 update t2,v2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
@@ -857,76 +857,76 @@
 update t2,t1 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
 -- error 1093
 update t2,v1 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v2,t2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t1,t2 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v1,t2 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t2,v2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t2,t1 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
--- error 1093
+-- error 1423
 update t2,v1 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
--- error 1093
+-- error 1288
 update v3 set v3.col1 = (select max(col1) from v1);
--- error 1093
+-- error 1288
 update v3 set v3.col1 = (select max(col1) from t1);
--- error 1093
+-- error 1288
 update v3 set v3.col1 = (select max(col1) from v2);
--- error 1093
+-- error 1288
 update v3 set v3.col1 = (select max(col1) from v3);
--- error 1093
+-- error 1288
 delete from v2 where col1 = (select max(col1) from v1);
--- error 1093
+-- error 1288
 delete from v2 where col1 = (select max(col1) from t1);
--- error 1093
+-- error 1288
 delete from v2 where col1 = (select max(col1) from v2);
--- error 1093
+-- error 1288
 delete v2 from v2,t2 where (select max(col1) from v1) > 0 and v2.col1 = t2.col1;
--- error 1093
+-- error 1423
 delete t1 from t1,t2 where (select max(col1) from v1) > 0 and t1.col1 = t2.col1;
--- error 1093
+-- error 1288
 delete v1 from v1,t2 where (select max(col1) from v1) > 0 and v1.col1 = t2.col1;
--- error 1093
+-- error 1288
 delete v2 from v2,t2 where (select max(col1) from t1) > 0 and v2.col1 = t2.col1;
 -- error 1093
 delete t1 from t1,t2 where (select max(col1) from t1) > 0 and t1.col1 = t2.col1;
--- error 1093
+-- error 1288
 delete v1 from v1,t2 where (select max(col1) from t1) > 0 and v1.col1 = t2.col1;
--- error 1093
+-- error 1288
 delete v2 from v2,t2 where (select max(col1) from v2) > 0 and v2.col1 = t2.col1;
--- error 1093
+-- error 1423
 delete t1 from t1,t2 where (select max(col1) from v2) > 0 and t1.col1 = t2.col1;
--- error 1093
+-- error 1288
 delete v1 from v1,t2 where (select max(col1) from v2) > 0 and v1.col1 = t2.col1;
--- error 1093
+-- error 1288
 insert into v2 values ((select max(col1) from v1));
--- error 1093
+-- error 1423
 insert into t1 values ((select max(col1) from v1));
--- error 1093
+-- error 1288
 insert into v2 values ((select max(col1) from v1));
--- error 1093
+-- error 1288
 insert into v2 values ((select max(col1) from t1));
 -- error 1093
 insert into t1 values ((select max(col1) from t1));
--- error 1093
+-- error 1288
 insert into v2 values ((select max(col1) from t1));
--- error 1093
+-- error 1288
 insert into v2 values ((select max(col1) from v2));
--- error 1093
+-- error 1423
 insert into t1 values ((select max(col1) from v2));
--- error 1093
+-- error 1288
 insert into v2 values ((select max(col1) from v2));
--- error 1093
+-- error 1288
 insert into v3 (col1) values ((select max(col1) from v1));
--- error 1093
+-- error 1288
 insert into v3 (col1) values ((select max(col1) from t1));
--- error 1093
+-- error 1288
 insert into v3 (col1) values ((select max(col1) from v2));
 #check with TZ tables in list
--- error 1093
+-- error 1288
 insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
 insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
 -- error 1048
@@ -1242,7 +1242,7 @@
 -- error 1288
 insert into v3 values (30);
 create view v4 as select * from v2 where 20 < (select (s1) from t1);
--- error 1093
+-- error 1288
 insert into v4 values (30);
 drop view v4, v3, v2, v1;
 drop table t1;
@@ -1685,3 +1685,18 @@
 CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1);
 SELECT * FROM v1;
 drop view v1;
+
+#
+# hide underlying tables names in case of imposibility to update (BUG#10773)
+#
+create table t1 (f59 int, f60 int, f61 int);
+insert into t1 values (19,41,32);
+create view v1 as select f59, f60 from t1 where f59 in  
+         (select f59 from t1);
+-- error 1288
+update v1 set f60=2345;
+-- error 1423
+update t1 set f60=(select max(f60) from v1);
+drop view v1;
+drop table t1;
+

--- 1.48/sql/sql_view.cc	Tue Jun 21 20:30:44 2005
+++ 1.49/sql/sql_view.cc	Fri Jun 24 21:21:43 2005
@@ -720,9 +720,7 @@
   }
   if (!res && !thd->is_fatal_error)
   {
-    TABLE_LIST *top_view= (table->belong_to_view ?
-                           table->belong_to_view :
-                           table);
+    TABLE_LIST *top_view= table->top_table();
     TABLE_LIST *view_tables= lex->query_tables;
     TABLE_LIST *view_tables_tail= 0;
     TABLE_LIST *tbl;
@@ -1072,8 +1070,7 @@
       thd->lex->select_lex.select_limit == 0)
     DBUG_RETURN(FALSE); /* it is normal table or query without LIMIT */
   table= view->table;
-  if (view->belong_to_view)
-    view= view->belong_to_view;
+  view= view->top_table();
   trans= view->field_translation;
   key_info_end= (key_info= table->key_info)+ table->s->keys;
 
Thread
bk commit into 5.0 tree (bell:1.2007) BUG#10773sanja24 Jun