summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-29 09:05:15 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-29 09:05:15 +0300
commit0632b8034b08c88176dc7db12ba53df04edd9300 (patch)
tree5047cc21a5cab2318bd8421f85f56b3e201ddd4a /sql
parent503fd2115bdc79f0b005917e058855411fdeb691 (diff)
parent1fbdcada73c1861b85080eede95140296d6a3c20 (diff)
downloadmariadb-git-0632b8034b08c88176dc7db12ba53df04edd9300.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc5
-rw-r--r--sql/handler.h5
-rw-r--r--sql/sql_table.cc6
3 files changed, 10 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 6a82cadc229..c371da22a87 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4647,7 +4647,7 @@ Alter_inplace_info::Alter_inplace_info(HA_CREATE_INFO *create_info_arg,
Alter_info *alter_info_arg,
KEY *key_info_arg, uint key_count_arg,
partition_info *modified_part_info_arg,
- bool ignore_arg)
+ bool ignore_arg, bool error_non_empty)
: create_info(create_info_arg),
alter_info(alter_info_arg),
key_info_buffer(key_info_arg),
@@ -4663,7 +4663,8 @@ Alter_inplace_info::Alter_inplace_info(HA_CREATE_INFO *create_info_arg,
modified_part_info(modified_part_info_arg),
ignore(ignore_arg),
online(false),
- unsupported_reason(nullptr)
+ unsupported_reason(nullptr),
+ error_if_not_empty(error_non_empty)
{}
void Alter_inplace_info::report_unsupported_error(const char *not_supported,
diff --git a/sql/handler.h b/sql/handler.h
index 0c9d60b7c90..756481f06bb 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -2453,11 +2453,14 @@ public:
*/
const char *unsupported_reason;
+ /** true when InnoDB should abort the alter when table is not empty */
+ bool error_if_not_empty;
+
Alter_inplace_info(HA_CREATE_INFO *create_info_arg,
Alter_info *alter_info_arg,
KEY *key_info_arg, uint key_count_arg,
partition_info *modified_part_info_arg,
- bool ignore_arg);
+ bool ignore_arg, bool error_non_empty);
~Alter_inplace_info()
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index ed98ae34e95..5d3906dc644 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -10023,7 +10023,7 @@ do_continue:;
Alter_inplace_info ha_alter_info(create_info, alter_info,
key_info, key_count,
IF_PARTITIONING(thd->work_part_info, NULL),
- ignore);
+ ignore, alter_ctx.error_if_not_empty);
TABLE_SHARE altered_share;
TABLE altered_table;
bool use_inplace= true;
@@ -10468,8 +10468,8 @@ err_new_table_cleanup:
bool save_abort_on_warning= thd->abort_on_warning;
thd->abort_on_warning= true;
thd->push_warning_truncated_value_for_field(Sql_condition::WARN_LEVEL_WARN,
- f_type, f_val,
- new_table->s,
+ f_type, f_val, new_table
+ ? new_table->s : table->s,
alter_ctx.datetime_field->
field_name.str);
thd->abort_on_warning= save_abort_on_warning;