<?xml version="1.0" encoding="utf-8"?>
<launchpad-bug id="998321">
  <date_last_updated>2012-05-17 07:14:20.835927+00:00</date_last_updated>
  <api_links>
    <bug_api_link>https://api.launchpad.net/1.0/bugs/998321</bug_api_link>
    <bug_owner_link>https://api.launchpad.net/1.0/~igorb-seattle</bug_owner_link>
    <milestone_link>https://api.launchpad.net/1.0/maria/+milestone/5.1</milestone_link>
    <linked_branches_collection_link>https://api.launchpad.net/1.0/bugs/998321/linked_branches</linked_branches_collection_link>
    <activity_link>https://api.launchpad.net/1.0/bugs/998321/activity</activity_link>
  </api_links>
  <bug_web_link>https://bugs.launchpad.net/bugs/998321</bug_web_link>
  <owner>Igor Babaev</owner>
  <assignee>Oleksandr &quot;Sanja&quot; Byelkin</assignee>
  <milestone_title>Maria 5.1</milestone_title>
  <duplicate_link></duplicate_link>
  <duplicate_bug_id></duplicate_bug_id>
  <title>Simple query with IF expression causes an assertion abort</title>
  <status>Fix Released</status>
  <importance>Critical</importance>
  <created>2012-05-12 04:19:29.800749+00:00</created>
  <description>
<![CDATA[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)]]>  </description>
  <activities>
    <activity datechanged="2012-05-12T04:19:29.800749+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[]]>      </newvalue>
      <whatchanged>bug</whatchanged>
      <person>Igor Babaev</person>
      <message>added bug</message>
    </activity>
    <activity datechanged="2012-05-12T04:19:46.287817+00:00">
      <oldvalue>
<![CDATA[New]]>      </oldvalue>
      <newvalue>
<![CDATA[Confirmed]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2012-05-12T04:19:51.352962+00:00">
      <oldvalue>
<![CDATA[Undecided]]>      </oldvalue>
      <newvalue>
<![CDATA[Critical]]>      </newvalue>
      <whatchanged>maria: importance</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2012-05-12T04:20:09.837238+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[Oleksandr "Sanja" Byelkin (sanja-byelkin)]]>      </newvalue>
      <whatchanged>maria: assignee</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2012-05-12T04:20:29.677920+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[5.1]]>      </newvalue>
      <whatchanged>maria: milestone</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2012-05-14T08:44:09.083048+00:00">
      <oldvalue>
<![CDATA[Confirmed]]>      </oldvalue>
      <newvalue>
<![CDATA[In Progress]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Oleksandr &quot;Sanja&quot; Byelkin</person>
      <message></message>
    </activity>
    <activity datechanged="2012-05-15T10:41:39.695888+00:00">
      <oldvalue>
<![CDATA[In Progress]]>      </oldvalue>
      <newvalue>
<![CDATA[Fix Committed]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Oleksandr &quot;Sanja&quot; Byelkin</person>
      <message></message>
    </activity>
    <activity datechanged="2012-05-17T07:14:19.624569+00:00">
      <oldvalue>
<![CDATA[Fix Committed]]>      </oldvalue>
      <newvalue>
<![CDATA[Fix Released]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Oleksandr &quot;Sanja&quot; Byelkin</person>
      <message></message>
    </activity>
  </activities>
  <comments>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/998321/comments/0" datecreated="2012-05-12T04:19:29.800749+00:00">
      <person>Igor Babaev</person>
      <subject>
<![CDATA[Simple query with IF expression causes an assertion abort]]>      </subject>
      <content>
<![CDATA[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)]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/998321/comments/1" datecreated="2012-05-14T12:52:33.604079+00:00">
      <person>Oleksandr &quot;Sanja&quot; Byelkin</person>
      <subject>
<![CDATA[Re: Simple query with IF expression causes an assertion abort]]>      </subject>
      <content>
<![CDATA[Problem is that cached_field_type of Item_func_if appeared to be MYSQL_TYPE_NULL...]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/998321/comments/2" datecreated="2012-05-14T13:07:57.820060+00:00">
      <person>Oleksandr &quot;Sanja&quot; Byelkin</person>
      <subject>
<![CDATA[Re: Simple query with IF expression causes an assertion abort]]>      </subject>
      <content>
<![CDATA[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.]]>      </content>
    </comment>
  </comments>
</launchpad-bug>
