Simple query with IF expression causes an assertion abort

Bug #998321 reported by Igor Babaev on 2012-05-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Oleksandr "Sanja" Byelkin

Bug Description

The following simple query causes an assertion abort in MariaDB 5.1/5.2:

SELECT if(1, (SELECT min('hello')), NULL);

(see also bug#12620084 for mysql code line)

Changed in maria:
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin)
milestone: none → 5.1
Changed in maria:
status: Confirmed → In Progress

Problem is that cached_field_type of Item_func_if appeared to be MYSQL_TYPE_NULL...

Above caused by subselect reporting that it is constant and null_value is set in the tests:

  bool null1=args[1]->const_item() && args[1]->null_value;
  bool null2=args[2]->const_item() && args[2]->null_value;

IMHO above tests are not correct: they should chec basic_constant_item or call is_null_value() method to really evaluate the item.

Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers