MDEV-31030 Assertion `!error' failed in ha_partition::update_row on UPDATE

Removing wrong assertion as division by zero was caused by valid
input.
This commit is contained in:
Aleksey Midenkov 2024-12-03 13:49:42 +03:00
parent 55b5993205
commit 27c25ceedb
3 changed files with 40 additions and 1 deletions

View File

@ -2857,3 +2857,23 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t3 ref_or_null a1,b a1 10 func,test.t2.a 198 Using where; Full scan on NULL key
set optimizer_switch=@tmp_os;
drop table t1,t2,t3;
#
# MDEV-31030 Assertion `!error' failed in ha_partition::update_row on UPDATE
#
create table t (c int)
partition by list (1 div c) (
partition p0 values in (null),
partition p values in (1));
insert ignore into t values (0), (1), (0);
Warnings:
Warning 1365 Division by 0
Warning 1365 Division by 0
update t set c= 2;
ERROR HY000: Table has no partition for value 0
update ignore t set c= 3;
select * from t;
c
0
0
1
drop table t;

View File

@ -3068,3 +3068,19 @@ set optimizer_switch=@tmp_os;
drop table t1,t2,t3;
--echo #
--echo # MDEV-31030 Assertion `!error' failed in ha_partition::update_row on UPDATE
--echo #
create table t (c int)
partition by list (1 div c) (
partition p0 values in (null),
partition p values in (1));
insert ignore into t values (0), (1), (0);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
update t set c= 2;
--disable_warnings
update ignore t set c= 3;
--enable_warnings
select * from t;
drop table t;

View File

@ -4591,7 +4591,10 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data)
Notice that HA_READ_BEFORE_WRITE_REMOVAL does not require this protocol,
so this is not supported for this engine.
*/
error= get_part_for_buf(old_data, m_rec0, m_part_info, &old_part_id);
{
Abort_on_warning_instant_set old_abort_on_warning(thd, 0);
error= get_part_for_buf(old_data, m_rec0, m_part_info, &old_part_id);
}
DBUG_ASSERT(!error);
DBUG_ASSERT(old_part_id == m_last_part);
DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), old_part_id));