summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-08-10 12:21:08 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-10 12:21:08 +0200
commit65e8506ca9d03967191b6ed207cf107d311f7f99 (patch)
tree3076ff798884b52655a5961be21e799708a4b628 /sql/sql_union.cc
parent6adfce9c8d2a63a259dd0504600271498dcda228 (diff)
parentfaddcf3c395da640b760c3f701f5bc1f3baae6c4 (diff)
downloadmariadb-git-65e8506ca9d03967191b6ed207cf107d311f7f99.tar.gz
Merge branch '10.3' into bb-10.4-releasemariadb-10.4.26
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index ada09be071e..70a521696d2 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -297,7 +297,27 @@ bool select_unit::send_eof()
int select_union_recursive::send_data(List<Item> &values)
{
- int rc= select_unit::send_data(values);
+
+ int rc;
+ bool save_abort_on_warning= thd->abort_on_warning;
+ enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
+ long save_counter;
+
+ /*
+ For recursive CTE's give warnings for wrong field info
+ However, we don't do that for CREATE TABLE ... SELECT or INSERT ... SELECT
+ as the upper level code for these handles setting of abort_on_warning
+ depending on if 'IGNORE' is used.
+ */
+ if (thd->lex->sql_command != SQLCOM_CREATE_TABLE &&
+ thd->lex->sql_command != SQLCOM_INSERT_SELECT)
+ thd->abort_on_warning= thd->is_strict_mode();
+ thd->count_cuted_fields= CHECK_FIELD_WARN;
+ save_counter= thd->get_stmt_da()->set_current_row_for_warning(++row_counter);
+ rc= select_unit::send_data(values);
+ thd->get_stmt_da()->set_current_row_for_warning(save_counter);
+ thd->count_cuted_fields= save_count_cuted_fields;
+ thd->abort_on_warning= save_abort_on_warning;
if (rc == 0 &&
write_err != HA_ERR_FOUND_DUPP_KEY &&
@@ -476,6 +496,7 @@ void select_union_recursive::cleanup()
thd->rec_tables= tab;
tbl->derived_result= 0;
}
+ row_counter= 0;
}