diff options
-rw-r--r-- | mysql-test/suite/parts/r/insert_ignore-5421.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/parts/t/insert_ignore-5421.test | 12 | ||||
-rw-r--r-- | sql/ha_partition.cc | 2 | ||||
-rw-r--r-- | sql/partition_info.cc | 6 | ||||
-rw-r--r-- | sql/partition_info.h | 2 |
5 files changed, 26 insertions, 5 deletions
diff --git a/mysql-test/suite/parts/r/insert_ignore-5421.result b/mysql-test/suite/parts/r/insert_ignore-5421.result new file mode 100644 index 00000000000..6cbb21fe2d7 --- /dev/null +++ b/mysql-test/suite/parts/r/insert_ignore-5421.result @@ -0,0 +1,9 @@ +CREATE TABLE t1 (i INT) ENGINE=MyISAM +PARTITION BY RANGE (i) ( +PARTITION p00 VALUES LESS THAN (1), +PARTITION p01 VALUES LESS THAN (2) +); +INSERT IGNORE INTO t1 VALUES (3); +Warnings: +Warning 1526 Table has no partition for value 3 +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/insert_ignore-5421.test b/mysql-test/suite/parts/t/insert_ignore-5421.test new file mode 100644 index 00000000000..889f2ccae7b --- /dev/null +++ b/mysql-test/suite/parts/t/insert_ignore-5421.test @@ -0,0 +1,12 @@ +# +# MDEV-5421 Assertion `! is_set()' fails on INSERT IGNORE when a table has no partition for a value +# + +--source include/have_partition.inc +CREATE TABLE t1 (i INT) ENGINE=MyISAM +PARTITION BY RANGE (i) ( + PARTITION p00 VALUES LESS THAN (1), + PARTITION p01 VALUES LESS THAN (2) +); +INSERT IGNORE INTO t1 VALUES (3); +DROP TABLE t1; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index cdb8690ba62..84a48cfed07 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -7207,7 +7207,7 @@ void ha_partition::print_error(int error, myf errflag) { if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION)) { - m_part_info->print_no_partition_found(table); + m_part_info->print_no_partition_found(table, errflag); DBUG_VOID_RETURN; } } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 8513ed854b7..1bfa8864cb9 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1330,7 +1330,7 @@ end: RETURN VALUES */ -void partition_info::print_no_partition_found(TABLE *table_arg) +void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag) { char buf[100]; char *buf_ptr= (char*)&buf; @@ -1344,7 +1344,7 @@ void partition_info::print_no_partition_found(TABLE *table_arg) SELECT_ACL, &table_list, TRUE)) { my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE, - ER(ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), MYF(0)); + ER(ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), errflag); } else { @@ -1360,7 +1360,7 @@ void partition_info::print_no_partition_found(TABLE *table_arg) part_expr->unsigned_flag ? 10 : -10); dbug_tmp_restore_column_map(table_arg->read_set, old_map); } - my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr); + my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, errflag, buf_ptr); } } diff --git a/sql/partition_info.h b/sql/partition_info.h index d3706c8abf4..ffd6e25c45c 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -288,7 +288,7 @@ public: bool check_partition_info(THD *thd, handlerton **eng_type, handler *file, HA_CREATE_INFO *info, bool check_partition_function); - void print_no_partition_found(TABLE *table); + void print_no_partition_found(TABLE *table, myf errflag); void print_debug(const char *str, uint*); Item* get_column_item(Item *item, Field *field); int fix_partition_values(THD *thd, |