Skip to content

Commit

Permalink
MDEV-12874 UPDATE statements with the same source and target
Browse files Browse the repository at this point in the history
fix --ps-protocol
  • Loading branch information
vuvova committed Oct 3, 2017
1 parent 1a74d12 commit ac2db25
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sql/sql_prepare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,7 @@ static int mysql_test_update(Prepared_statement *stmt,
int res;
THD *thd= stmt->thd;
uint table_count= 0;
TABLE_LIST *update_source_table;
SELECT_LEX *select= &stmt->lex->select_lex;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
Expand All @@ -1413,9 +1414,11 @@ static int mysql_test_update(Prepared_statement *stmt,
if (mysql_handle_derived(thd->lex, DT_INIT))
goto error;

if (table_list->is_multitable())
if (((update_source_table= unique_table(thd, table_list,
table_list->next_global, 0)) ||
table_list->is_multitable()))
{
DBUG_ASSERT(table_list->view != 0);
DBUG_ASSERT(update_source_table || table_list->view != 0);
DBUG_PRINT("info", ("Switch to multi-update"));
/* pass counter value */
thd->lex->table_count= table_count;
Expand Down

0 comments on commit ac2db25

Please sign in to comment.