RQG: Crash in get_datetime_value() with virtual columns

Bug #604503 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
High
Igor Babaev

Bug Description

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

Changed in maria:
importance: Undecided → High
status: New → In Progress
assignee: nobody → Igor Babaev (igorb-seattle)
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
milestone: none → 5.2
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.