summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-10-03 21:07:27 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-03 21:07:27 +0200
commitac2db256d9a390269a891a2addccf8ae1453cdb2 (patch)
treeb30b10267344409f89e456604df5f067b9dfab84
parent1a74d12da674d49304ffdc62e100ba8d19f90f13 (diff)
downloadmariadb-git-ac2db256d9a390269a891a2addccf8ae1453cdb2.tar.gz
MDEV-12874 UPDATE statements with the same source and target
fix --ps-protocol
-rw-r--r--sql/sql_prepare.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 4df92c71006..9de0a6d0e99 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -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;
@@ -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;