diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-07-21 20:11:07 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-07-21 20:11:07 +0200 |
commit | 6190a02f3593f82e2d4916ed660afb5e5d631a5a (patch) | |
tree | f6fc56fd7aad1a332f9fc6850b2d579198d09ff8 /sql/sql_prepare.cc | |
parent | cf6d83e7d68bd2bc0af0404bf4dd15218847074d (diff) | |
parent | 4c387945f0f8d5df84ae987c4a4bba7675815c72 (diff) | |
download | mariadb-git-6190a02f3593f82e2d4916ed660afb5e5d631a5a.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ae070ec8db0..8138e633f3e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1619,7 +1619,12 @@ static int mysql_test_select(Prepared_statement *stmt, if (!lex->describe && !thd->lex->analyze_stmt && !stmt->is_sql_prepare()) { /* Make copy of item list, as change_columns may change it */ - List<Item> fields(lex->select_lex.item_list); + SELECT_LEX_UNIT* master_unit= unit->first_select()->master_unit(); + bool is_union_op= + master_unit->is_unit_op() || master_unit->fake_select_lex; + + List<Item> fields(is_union_op ? unit->item_list : + lex->select_lex.item_list); /* Change columns if a procedure like analyse() */ if (unit->last_procedure && unit->last_procedure->change_columns(thd, fields)) |