diff options
author | Igor Babaev <igor@askmonty.org> | 2022-09-16 22:36:22 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2022-09-16 22:36:22 -0700 |
commit | 4100aac0bd14e25c79339b3e23e6d1022b4e8d50 (patch) | |
tree | 4a8be0e83ffbd80b2da4ad1d7134fd9bc24d70bd | |
parent | 768019354507ee0237530ffff46099061e173974 (diff) | |
download | mariadb-git-bb-10.11-MDEV-28883.tar.gz |
Another fix after the latest rebase of commits for MDEV-28883bb-10.11-MDEV-28883
-rw-r--r-- | mysql-test/main/derived.result | 6 | ||||
-rw-r--r-- | sql/sql_base.cc | 6 | ||||
-rw-r--r-- | sql/sql_delete.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 7 |
4 files changed, 13 insertions, 8 deletions
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index c28e01d5baf..6c10f195737 100644 --- a/mysql-test/main/derived.result +++ b/mysql-test/main/derived.result @@ -1432,8 +1432,7 @@ where a = ( select * from (select a from t1) dt where dt.a > 5) returning pk, a; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 3 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where delete from t1 where a = ( select * from (select a from t1) dt where dt.a > 5) returning pk, a; @@ -1472,8 +1471,7 @@ where a <> ( select * from (select a from t1) dt where dt.a > 7) order by a limit 2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using filesort -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 4 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where delete from t1 where a <> ( select * from (select a from t1) dt where dt.a > 7) order by a limit 2; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 404da7fb4cb..72864b7e329 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1205,7 +1205,7 @@ retry: if (thd->lex->sql_command == SQLCOM_UPDATE) { Sql_cmd_update *cmd= (Sql_cmd_update *) (thd->lex->m_sql_cmd); - if (cmd->is_multitable()) + if (cmd->is_multitable() || derived->derived->outer_select()) materialize= false; else if (!cmd->processing_as_multitable_update_prohibited(thd)) { @@ -1216,9 +1216,9 @@ retry: else if (thd->lex->sql_command == SQLCOM_DELETE) { Sql_cmd_delete *cmd= (Sql_cmd_delete *) (thd->lex->m_sql_cmd); - if (cmd->is_multitable()) + if (cmd->is_multitable() || derived->derived->outer_select()) materialize= false; - if (!cmd->processing_as_multitable_delete_prohibited(thd)) + else if (!cmd->processing_as_multitable_delete_prohibited(thd)) { cmd->set_as_multitable(); materialize= false; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 7ab5913ee09..42c8f7d00ce 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1501,7 +1501,9 @@ bool Sql_cmd_delete::precheck(THD *thd) return true; } +#ifdef WITH_WSREP WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE); +#endif return false; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 439ff63f51d..6e54e664152 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2824,7 +2824,10 @@ bool multi_update::send_eof() bool Sql_cmd_update::processing_as_multitable_update_prohibited(THD *thd) { - return false; + SELECT_LEX *const select_lex = thd->lex->first_select_lex(); + return + (select_lex->order_list.elements && + select_lex->limit_params.select_limit); } @@ -2848,7 +2851,9 @@ bool Sql_cmd_update::precheck(THD *thd) return true; } +#ifdef WITH_WSREP WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE); +#endif return false; |