post-merge: --ps-protocol fixes

Includes:

MDEV-17302 Add support for ALTER USER command in prepared statement

and

MDEV-17673 main.cte_recursive fails in bb-10.4-ps branch in --ps

  Set correct SELECT_LEX linkage for recursive CTEs.
  Do not delegate this job to TABLE_LIST::set_as_with_table,
  because it is only run on prepare, while With_element::move_anchors_ahead
  is run both on prepare and execute (fix by Igor)
This commit is contained in:
Sergei Golubchik 2019-03-15 15:06:17 +01:00
parent f1134d5676
commit 1f020299f8
7 changed files with 22 additions and 14 deletions

View File

@ -296,7 +296,9 @@ if ($CRC_RET_stmt_sidef) {
--echo
--echo Invoking $CRC_RET_desc.
if ($CRC_create) {
--disable_ps_protocol
--eval $CRC_create
--enable_ps_protocol
}
--echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings.

View File

@ -31,12 +31,11 @@ count(*)
set debug_dbug='';
select event_name
from
performance_schema.events_stages_history_long
performance_schema.events_stages_history_long join
performance_schema.threads using (thread_id)
where
event_name like '%show explain' and
thread_id in(select thread_id
from performance_schema.events_statements_history_long
where EVENT_NAME='statement/sql/show_explain');
processlist_id=$thr1;
event_name
stage/sql/show explain
drop table t0;

View File

@ -1166,7 +1166,9 @@ DROP TABLE t;
CREATE TABLE t (a INT) ENGINE=INNODB;
-- remove_file $MYSQL_DATA_DIR/test/t.frm
-- move_file $MYSQL_DATA_DIR/test/t.fr_ $MYSQL_DATA_DIR/test/t.frm
--enable_prepare_warnings
SHOW CREATE TABLE t;
--disable_prepare_warnings
DROP TABLE t;
--disable_query_log

View File

@ -49,12 +49,12 @@ reap;
set debug_dbug='';
select event_name
from
performance_schema.events_stages_history_long
where
event_name like '%show explain' and
thread_id in(select thread_id
from performance_schema.events_statements_history_long
where EVENT_NAME='statement/sql/show_explain');
evalp select event_name
from
performance_schema.events_stages_history_long join
performance_schema.threads using (thread_id)
where
event_name like '%show explain' and
processlist_id=$thr1;
drop table t0;

View File

@ -689,6 +689,7 @@ void With_element::move_anchors_ahead()
}
}
first_recursive= new_pos;
spec->first_select()->linkage= DERIVED_TABLE_TYPE;
}

View File

@ -2479,8 +2479,11 @@ void log_slow_statement(THD *thd)
if (!thd->enable_slow_log)
goto end; // E.g. SP statement
DBUG_EXECUTE_IF("simulate_slow_query",
thd->server_status|= SERVER_QUERY_WAS_SLOW;);
DBUG_EXECUTE_IF("simulate_slow_query", {
if (thd->get_command() == COM_QUERY ||
thd->get_command() == COM_STMT_EXECUTE)
thd->server_status|= SERVER_QUERY_WAS_SLOW;
});
if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
((thd->server_status &

View File

@ -2530,6 +2530,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
case SQLCOM_ALTER_DB_UPGRADE:
case SQLCOM_CHECKSUM:
case SQLCOM_CREATE_USER:
case SQLCOM_ALTER_USER:
case SQLCOM_RENAME_USER:
case SQLCOM_DROP_USER:
case SQLCOM_CREATE_ROLE: