<?xml version="1.0" encoding="utf-8"?>
<launchpad-bug id="604503">
  <date_last_updated>2011-12-13 15:22:18.357422+00:00</date_last_updated>
  <api_links>
    <bug_api_link>https://api.launchpad.net/1.0/bugs/604503</bug_api_link>
    <bug_owner_link>https://api.launchpad.net/1.0/~pstoev-askmonty</bug_owner_link>
    <milestone_link>https://api.launchpad.net/1.0/maria/+milestone/5.2</milestone_link>
    <linked_branches_collection_link>https://api.launchpad.net/1.0/bugs/604503/linked_branches</linked_branches_collection_link>
    <activity_link>https://api.launchpad.net/1.0/bugs/604503/activity</activity_link>
  </api_links>
  <bug_web_link>https://bugs.launchpad.net/bugs/604503</bug_web_link>
  <owner>Philip Stoev</owner>
  <assignee>Igor Babaev</assignee>
  <milestone_title>Maria 5.2</milestone_title>
  <duplicate_link></duplicate_link>
  <duplicate_bug_id></duplicate_bug_id>
  <title>RQG: Crash in get_datetime_value() with virtual columns</title>
  <status>Fix Released</status>
  <importance>High</importance>
  <created>2010-07-12 08:10:37.275850+00:00</created>
  <description>
<![CDATA[The following SQL crashes the server. Note that the virtual column expression is not exactly correct type-wise:

CREATE TABLE IF NOT EXISTS X (
 f3 DATETIME NOT NULL DEFAULT 0,
 v2 BOOLEAN AS ( f3 < ( GET_FORMAT( DATETIME, 'INTERNAL' ) ) ) PERSISTENT
);
INSERT INTO X ( f3 ) VALUES ( '0000-00-00' );
INSERT INTO X ( f3 ) VALUES ( '0000-00-00' );
DELETE FROM X;


backtrace:

#3  0x0826c124 in handle_segfault (sig=11) at mysqld.cc:2693
#4  <signal handler called>
#5  0x081ecfdc in get_datetime_value (thd=0x9f5c658, item_arg=0xb5de7f9c, cache_arg=0xb5de7fc8, warn_item=0xb5de7d88, is_null=0xb60d1d3e)
    at item_cmpfunc.cc:1096
#6  0x081ed44e in Arg_comparator::compare_datetime (this=0xb5de7f98) at item_cmpfunc.cc:1255
#7  0x081d340a in Arg_comparator::compare (this=0xb5de7f98) at item_cmpfunc.h:81
#8  0x081ef15d in Item_func_lt::val_int (this=0xb5de7f20) at item_cmpfunc.cc:1918
#9  0x081bb793 in Item::save_in_field (this=0xb5de7f20, field=0xb5de7d18, no_conversions=false) at item.cc:5210
#10 0x082e2a0e in update_virtual_fields (table=0xb5dd6800, for_write=true) at table.cc:5448
#11 0x082d3298 in fill_record (thd=0x9f5c658, fields=..., values=..., ignore_errors=false) at sql_base.cc:8255
#12 0x082d338b in fill_record_n_invoke_before_triggers (thd=0x9f5c658, fields=..., values=..., ignore_errors=false, triggers=0x0, event=TRG_EVENT_INSERT)
    at sql_base.cc:8305
#13 0x08314322 in mysql_insert (thd=0x9f5c658, table_list=0xb5d4a138, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR,
    ignore=false) at sql_insert.cc:780
#14 0x0828153b in mysql_execute_command (thd=0x9f5c658) at sql_parse.cc:3209
#15 0x08289fa0 in mysql_parse (thd=0x9f5c658, inBuf=0xb5d4a068 "INSERT INTO X ( f3 ) VALUES ( '0000-00-00' )", length=44, found_semicolon=0xb60d3230)
    at sql_parse.cc:6024
#16 0x0827c1fa in dispatch_command (command=COM_QUERY, thd=0x9f5c658, packet=0x9f74571 "INSERT INTO X ( f3 ) VALUES ( '0000-00-00' )", packet_length=44)
    at sql_parse.cc:1183
#17 0x0827b6a0 in do_command (thd=0x9f5c658) at sql_parse.cc:890
#18 0x08278800 in handle_one_connection (arg=0x9f5c658) at sql_connect.cc:1153
#19 0x00a08919 in start_thread () from /lib/libpthread.so.0
#20 0x00951e5e in clone () from /lib/libc.so.6]]>  </description>
  <activities>
    <activity datechanged="2010-07-12T08:10:37.275850+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[]]>      </newvalue>
      <whatchanged>bug</whatchanged>
      <person>Philip Stoev</person>
      <message>added bug</message>
    </activity>
    <activity datechanged="2010-07-16T16:52:41.961862+00:00">
      <oldvalue>
<![CDATA[Undecided]]>      </oldvalue>
      <newvalue>
<![CDATA[High]]>      </newvalue>
      <whatchanged>maria: importance</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2010-07-16T16:52:56.742478+00:00">
      <oldvalue>
<![CDATA[New]]>      </oldvalue>
      <newvalue>
<![CDATA[In Progress]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2010-07-16T16:53:05.253968+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[Igor Babaev (igorb-seattle)]]>      </newvalue>
      <whatchanged>maria: assignee</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2010-07-18T00:11:42.999802+00:00">
      <oldvalue>
<![CDATA[In Progress]]>      </oldvalue>
      <newvalue>
<![CDATA[Fix Committed]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Igor Babaev</person>
      <message></message>
    </activity>
    <activity datechanged="2010-07-27T13:48:34.383356+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[5.2]]>      </newvalue>
      <whatchanged>maria: milestone</whatchanged>
      <person>Sergei</person>
      <message></message>
    </activity>
    <activity datechanged="2011-12-13T15:22:17.341551+00:00">
      <oldvalue>
<![CDATA[Fix Committed]]>      </oldvalue>
      <newvalue>
<![CDATA[Fix Released]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Daniel Bartholomew</person>
      <message></message>
    </activity>
  </activities>
  <comments>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/604503/comments/0" datecreated="2010-07-12T08:10:37.275850+00:00">
      <person>Philip Stoev</person>
      <subject>
<![CDATA[RQG: Crash in get_datetime_value() with virtual columns]]>      </subject>
      <content>
<![CDATA[The following SQL crashes the server. Note that the virtual column expression is not exactly correct type-wise:

CREATE TABLE IF NOT EXISTS X (
 f3 DATETIME NOT NULL DEFAULT 0,
 v2 BOOLEAN AS ( f3 < ( GET_FORMAT( DATETIME, 'INTERNAL' ) ) ) PERSISTENT
);
INSERT INTO X ( f3 ) VALUES ( '0000-00-00' );
INSERT INTO X ( f3 ) VALUES ( '0000-00-00' );
DELETE FROM X;


backtrace:

#3  0x0826c124 in handle_segfault (sig=11) at mysqld.cc:2693
#4  <signal handler called>
#5  0x081ecfdc in get_datetime_value (thd=0x9f5c658, item_arg=0xb5de7f9c, cache_arg=0xb5de7fc8, warn_item=0xb5de7d88, is_null=0xb60d1d3e)
    at item_cmpfunc.cc:1096
#6  0x081ed44e in Arg_comparator::compare_datetime (this=0xb5de7f98) at item_cmpfunc.cc:1255
#7  0x081d340a in Arg_comparator::compare (this=0xb5de7f98) at item_cmpfunc.h:81
#8  0x081ef15d in Item_func_lt::val_int (this=0xb5de7f20) at item_cmpfunc.cc:1918
#9  0x081bb793 in Item::save_in_field (this=0xb5de7f20, field=0xb5de7d18, no_conversions=false) at item.cc:5210
#10 0x082e2a0e in update_virtual_fields (table=0xb5dd6800, for_write=true) at table.cc:5448
#11 0x082d3298 in fill_record (thd=0x9f5c658, fields=..., values=..., ignore_errors=false) at sql_base.cc:8255
#12 0x082d338b in fill_record_n_invoke_before_triggers (thd=0x9f5c658, fields=..., values=..., ignore_errors=false, triggers=0x0, event=TRG_EVENT_INSERT)
    at sql_base.cc:8305
#13 0x08314322 in mysql_insert (thd=0x9f5c658, table_list=0xb5d4a138, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR,
    ignore=false) at sql_insert.cc:780
#14 0x0828153b in mysql_execute_command (thd=0x9f5c658) at sql_parse.cc:3209
#15 0x08289fa0 in mysql_parse (thd=0x9f5c658, inBuf=0xb5d4a068 "INSERT INTO X ( f3 ) VALUES ( '0000-00-00' )", length=44, found_semicolon=0xb60d3230)
    at sql_parse.cc:6024
#16 0x0827c1fa in dispatch_command (command=COM_QUERY, thd=0x9f5c658, packet=0x9f74571 "INSERT INTO X ( f3 ) VALUES ( '0000-00-00' )", packet_length=44)
    at sql_parse.cc:1183
#17 0x0827b6a0 in do_command (thd=0x9f5c658) at sql_parse.cc:890
#18 0x08278800 in handle_one_connection (arg=0x9f5c658) at sql_connect.cc:1153
#19 0x00a08919 in start_thread () from /lib/libpthread.so.0
#20 0x00951e5e in clone () from /lib/libc.so.6]]>      </content>
    </comment>
  </comments>
</launchpad-bug>
