diff options
author | unknown <bell@sanja.is.com.ua> | 2005-08-02 22:54:49 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-08-02 22:54:49 +0300 |
commit | 705118d1f627c6aa9a14f2a00f080b13af7b3484 (patch) | |
tree | fa83e9de145ab2dfa580ead7f709f663f5c7e67b /sql/sql_update.cc | |
parent | b80eb2b5a83ad7e1ad8fbca7cb94030b3297a3e0 (diff) | |
download | mariadb-git-705118d1f627c6aa9a14f2a00f080b13af7b3484.tar.gz |
issue correct error message in case of view presence for duplicated table on update (BUG#10773)
frequently used command sequence replaced with inline function
BitKeeper/etc/config:
logging switching off
mysql-test/r/lowercase_view.result:
hided view underlying tables from error message
mysql-test/r/view.result:
hided view underlying tables from error message
mysql-test/t/lowercase_view.test:
hided view underlying tables from error message
mysql-test/t/view.test:
hided view underlying tables from error message
sql/mysql_priv.h:
subroutine which return correct error message
sql/share/errmsg.txt:
new error message
sql/sql_base.cc:
subroutine which issue correct error message in case of view presence for duplicated table on update
sql/sql_delete.cc:
issue correct error message in case of view presence for duplicated table on update
sql/sql_insert.cc:
issue correct error message in case of view presence for duplicated table on update
sql/sql_parse.cc:
issue correct error message in case of view presence for duplicated table on update
sql/sql_update.cc:
issue correct error message in case of view presence for duplicated table on update
sql/sql_view.cc:
frequently used command sequence replaced with inline function
sql/table.cc:
frequently used command sequence replaced with inline function
sql/table.h:
frequently used command sequence replaced with inline function
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 6b9a8ddfcb6..b448d56c254 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -566,10 +566,14 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, 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 @@ bool mysql_multi_update_prepare(THD *thd) { 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 @@ bool mysql_multi_update_prepare(THD *thd) 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); + } } } |