MDEV-29184 Assertion `0' in Item_row::illegal_method_call, Type_handler_row::Item_update_null_value, Item::update_null_value

- Moving the check_cols(1) test from fix_fields() to fix_length_and_dec().
  So the test is now done before the code calling val_decimal()
  in fix_length_and_dec().

- Removing Item_func_interval::fix_fields(), as it become equal
  to the inherited one.
This commit is contained in:
Alexander Barkov 2024-11-01 12:40:43 +04:00
parent 3734ff7c7e
commit dd41be2a51
4 changed files with 17 additions and 12 deletions

View file

@ -224,3 +224,8 @@ SELECT INTERVAL(1,ROW(1,2));
ERROR 21000: Operand should contain 1 column(s)
SELECT INTERVAL(ROW(1,2),1);
ERROR 21000: Operand should contain 1 column(s)
#
# MDEV-29184 Assertion `0' in Item_row::illegal_method_call, Type_handler_row::Item_update_null_value, Item::update_null_value
#
SELECT INTERVAL(0, ROW(1,1), 1, 1, 1, 1, 1, 1, 1) AS f;
ERROR 21000: Operand should contain 1 column(s)

View file

@ -147,3 +147,11 @@ SELECT INTERVAL(ROW(1,1),ROW(1,2));
SELECT INTERVAL(1,ROW(1,2));
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(ROW(1,2),1);
--echo #
--echo # MDEV-29184 Assertion `0' in Item_row::illegal_method_call, Type_handler_row::Item_update_null_value, Item::update_null_value
--echo #
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(0, ROW(1,1), 1, 1, 1, 1, 1, 1, 1) AS f;

View file

@ -1951,22 +1951,15 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const
}
bool Item_func_interval::fix_fields(THD *thd, Item **ref)
bool Item_func_interval::fix_length_and_dec()
{
if (Item_long_func::fix_fields(thd, ref))
return true;
for (uint i= 0 ; i < row->cols(); i++)
uint rows= row->cols();
for (uint i= 0 ; i < rows; i++)
{
if (row->element_index(i)->check_cols(1))
return true;
}
return false;
}
bool Item_func_interval::fix_length_and_dec()
{
uint rows= row->cols();
use_decimal_comparison= ((row->element_index(0)->result_type() ==
DECIMAL_RESULT) ||

View file

@ -1120,7 +1120,6 @@ public:
Item_func_interval(THD *thd, Item_row *a):
Item_long_func(thd, a), row(a), intervals(0)
{ }
bool fix_fields(THD *, Item **) override;
longlong val_int() override;
bool fix_length_and_dec() override;
LEX_CSTRING func_name_cstring() const override