summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
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;
}