1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

issue correct error message in case of view presence for duplicated table on update (BUG#10773)

frequently used command sequence replaced with inline function
This commit is contained in:
bell@sanja.is.com.ua
2005-08-02 22:54:49 +03:00
parent c9de0b15f2
commit 4c69fbe632
15 changed files with 293 additions and 190 deletions

View File

@ -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);
}
}
}