[MDEV-16217] Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date upon SELECT from view Created: 2018-05-18  Updated: 2018-11-14  Resolved: 2018-11-14

Status: Closed
Project: MariaDB Server
Component/s: Temporal Types, Views
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.3.11, 10.4.1, 10.2.20

Type: Bug Priority: Critical
Reporter: Alice Sherepa Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: affects-tests


 Description   

CREATE TABLE t1 (pk int  default 0, a1 date);
INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
 
CREATE VIEW v1 AS 
SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
 
SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1;

mysqld: /home/alice/git/10.2/sql/field.cc:2078: virtual bool Field_num::get_date(MYSQL_TIME*, ulonglong): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
180518 12:46:23 [ERROR] mysqld got signal 6 ;
Server version: 10.2.16-MariaDB-debug-log
 
Thread pointer: 0x7fa588000a98
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7fa598c0ce70 thread_stack 0x49000
mysys/stacktrace.c:267(my_print_stacktrace)[0x564f6448f14b]
sql/signal_handler.cc:168(handle_fatal_signal)[0x564f63d28c15]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fa59f581390]
linux/raise.c:54(__GI_raise)[0x7fa59e93a428]
stdlib/abort.c:91(__GI_abort)[0x7fa59e93c02a]
assert/assert.c:92(__assert_fail_base)[0x7fa59e932bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7fa59e932c82]
sql/field.cc:2079(Field_num::get_date(st_mysql_time*, unsigned long long))[0x564f63cfb41d]
sql/item.cc:2824(Item_field::get_date_result(st_mysql_time*, unsigned long long))[0x564f63d45401]
sql/item.cc:9799(Item_cache_temporal::cache_value())[0x564f63d595a2]
sql/item.cc:9717(Item_cache_temporal::val_datetime_packed())[0x564f63d5918e]
sql/item.h:1427(Item::val_temporal_packed(enum_field_types))[0x564f63d5de05]
sql/item_cmpfunc.cc:2166(Item_func_between::val_int())[0x564f63d6d1a1]
sql/item.cc:7009(Item::send(Protocol*, String*))[0x564f63d50f5b]
sql/protocol.cc:979(Protocol::send_result_set_row(List<Item>*))[0x564f639ee417]
sql/sql_class.cc:2800(select_send::send_data(List<Item>&))[0x564f63a70882]
sql/sql_select.cc:19863(end_send(JOIN*, st_join_table*, bool))[0x564f63b29b22]
sql/sql_select.cc:18915(evaluate_join_record(JOIN*, st_join_table*, int))[0x564f63b275ed]
sql/sql_select.cc:18695(sub_select(JOIN*, st_join_table*, bool))[0x564f63b26ede]
sql/sql_select.cc:18239(do_select(JOIN*, Procedure*))[0x564f63b26472]
sql/sql_select.cc:3570(JOIN::exec_inner())[0x564f63b00edf]
sql/sql_select.cc:3366(JOIN::exec())[0x564f63b00380]
sql/sql_select.cc:3767(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x564f63b01550]
sql/sql_select.cc:376(handle_select(THD*, LEX*, select_result*, unsigned long))[0x564f63af5ace]
sql/sql_parse.cc:6476(execute_sqlcom_select(THD*, TABLE_LIST*))[0x564f63ac16b6]
sql/sql_parse.cc:3483(mysql_execute_command(THD*))[0x564f63ab73f7]
sql/sql_parse.cc:7940(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x564f63ac524c]
sql/sql_parse.cc:1822(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x564f63ab2c56]
sql/sql_parse.cc:1374(do_command(THD*))[0x564f63ab15b2]
sql/sql_connect.cc:1335(do_handle_one_connection(CONNECT*))[0x564f63c006cb]
sql/sql_connect.cc:1242(handle_one_connection)[0x564f63c0044b]
perfschema/pfs.cc:1864(pfs_spawn_thread)[0x564f6442cc98]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fa59f5776ba]
x86_64/clone.S:111(clone)[0x7fa59ea0c41d]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7fa588149ba0): SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1
Connection ID (thread ID): 4
Status: NOT_KILLED

 10.2 de86997160ea5e02
Thread 1 (Thread 0x7fa598c0d700 (LWP 29177)):
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x0000564f6448f23d in my_write_core (sig=6) at /home/alice/git/10.2/mysys/stacktrace.c:477
#2  0x0000564f63d2903d in handle_fatal_signal (sig=6) at /home/alice/git/10.2/sql/signal_handler.cc:305
#3  <signal handler called>
#4  0x00007fa59e93a428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007fa59e93c02a in __GI_abort () at abort.c:89
#6  0x00007fa59e932bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x564f64667338 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=file@entry=0x564f646670d0 "/home/alice/git/10.2/sql/field.cc", line=line@entry=2078, function=function@entry=0x564f64668de0 <Field_num::get_date(st_mysql_time*, unsigned long long)::__PRETTY_FUNCTION__> "virtual bool Field_num::get_date(MYSQL_TIME*, ulonglong)") at assert.c:92
#7  0x00007fa59e932c82 in __GI___assert_fail (assertion=0x564f64667338 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=0x564f646670d0 "/home/alice/git/10.2/sql/field.cc", line=2078, function=0x564f64668de0 <Field_num::get_date(st_mysql_time*, unsigned long long)::__PRETTY_FUNCTION__> "virtual bool Field_num::get_date(MYSQL_TIME*, ulonglong)") at assert.c:101
#8  0x0000564f63cfb41d in Field_num::get_date (this=0x7fa58806a9c0, ltime=0x7fa598c0a5b0, fuzzydate=33554433) at /home/alice/git/10.2/sql/field.cc:2078
#9  0x0000564f63d45401 in Item_field::get_date_result (this=0x7fa58806d8d0, ltime=0x7fa598c0a5b0, fuzzydate=33554433) at /home/alice/git/10.2/sql/item.cc:2824
#10 0x0000564f63d595a2 in Item_cache_temporal::cache_value (this=0x7fa58806aac0) at /home/alice/git/10.2/sql/item.cc:9799
#11 0x0000564f63d5918e in Item_cache_temporal::val_datetime_packed (this=0x7fa58806aac0) at /home/alice/git/10.2/sql/item.cc:9717
#12 0x0000564f63d5de05 in Item::val_temporal_packed (this=0x7fa58806aac0, f_type=MYSQL_TYPE_DATE) at /home/alice/git/10.2/sql/item.h:1426
#13 0x0000564f63d6d1a1 in Item_func_between::val_int (this=0x7fa588120390) at /home/alice/git/10.2/sql/item_cmpfunc.cc:2166
#14 0x0000564f63d50f5b in Item::send (this=0x7fa588120390, protocol=0x7fa588001058, buffer=0x7fa598c0a8c0) at /home/alice/git/10.2/sql/item.cc:7009
#15 0x0000564f639ee417 in Protocol::send_result_set_row (this=0x7fa588001058, row_items=0x7fa588004ec8) at /home/alice/git/10.2/sql/protocol.cc:979
#16 0x0000564f63a70882 in select_send::send_data (this=0x7fa5881490e0, items=...) at /home/alice/git/10.2/sql/sql_class.cc:2800
#17 0x0000564f63b29b22 in end_send (join=0x7fa588183c00, join_tab=0x7fa58816f840, end_of_records=false) at /home/alice/git/10.2/sql/sql_select.cc:19863
#18 0x0000564f63b275ed in evaluate_join_record (join=0x7fa588183c00, join_tab=0x7fa58816f490, error=0) at /home/alice/git/10.2/sql/sql_select.cc:18915
#19 0x0000564f63b26ede in sub_select (join=0x7fa588183c00, join_tab=0x7fa58816f490, end_of_records=false) at /home/alice/git/10.2/sql/sql_select.cc:18695
#20 0x0000564f63b26472 in do_select (join=0x7fa588183c00, procedure=0x0) at /home/alice/git/10.2/sql/sql_select.cc:18239
#21 0x0000564f63b00edf in JOIN::exec_inner (this=0x7fa588183c00) at /home/alice/git/10.2/sql/sql_select.cc:3570
#22 0x0000564f63b00380 in JOIN::exec (this=0x7fa588183c00) at /home/alice/git/10.2/sql/sql_select.cc:3365
#23 0x0000564f63b01550 in mysql_select (thd=0x7fa588000a98, tables=0x7fa588140d40, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fa5881490e0, unit=0x7fa588004640, select_lex=0x7fa588004d98) at /home/alice/git/10.2/sql/sql_select.cc:3765
#24 0x0000564f63af5ace in handle_select (thd=0x7fa588000a98, lex=0x7fa588004578, result=0x7fa5881490e0, setup_tables_done_option=0) at /home/alice/git/10.2/sql/sql_select.cc:376
#25 0x0000564f63ac16b6 in execute_sqlcom_select (thd=0x7fa588000a98, all_tables=0x7fa588140d40) at /home/alice/git/10.2/sql/sql_parse.cc:6476
#26 0x0000564f63ab73f7 in mysql_execute_command (thd=0x7fa588000a98) at /home/alice/git/10.2/sql/sql_parse.cc:3483
#27 0x0000564f63ac524c in mysql_parse (thd=0x7fa588000a98, rawbuf=0x7fa588149ba0 "SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1", length=60, parser_state=0x7fa598c0c1f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:7940
#28 0x0000564f63ab2c56 in dispatch_command (command=COM_QUERY, thd=0x7fa588000a98, packet=0x7fa588007f39 "", packet_length=60, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:1820
#29 0x0000564f63ab15b2 in do_command (thd=0x7fa588000a98) at /home/alice/git/10.2/sql/sql_parse.cc:1374
#30 0x0000564f63c006cb in do_handle_one_connection (connect=0x564f65fb3f78) at /home/alice/git/10.2/sql/sql_connect.cc:1335
#31 0x0000564f63c0044b in handle_one_connection (arg=0x564f65fb3f78) at /home/alice/git/10.2/sql/sql_connect.cc:1241
#32 0x0000564f6442cc98 in pfs_spawn_thread (arg=0x564f65f18af8) at /home/alice/git/10.2/storage/perfschema/pfs.cc:1862
#33 0x00007fa59f5776ba in start_thread (arg=0x7fa598c0d700) at pthread_create.c:333
#34 0x00007fa59ea0c41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

 10.3 395c8ca708c15e7f4b
Thread 1 (Thread 0x7f30a63d6700 (LWP 29397)):
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x0000555b0581bc69 in my_write_core (sig=6) at /home/alice/git/10.3/mysys/stacktrace.c:481
#2  0x0000555b0500a4d1 in handle_fatal_signal (sig=6) at /home/alice/git/10.3/sql/signal_handler.cc:305
#3  <signal handler called>
#4  0x00007f30ac238428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007f30ac23a02a in __GI_abort () at abort.c:89
#6  0x00007f30ac230bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x555b05a8f480 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=file@entry=0x555b05a8f270 "/home/alice/git/10.3/sql/field.cc", line=line@entry=2068, function=function@entry=0x555b05a909e0 <Field_int::get_date(st_mysql_time*, unsigned long long)::__PRETTY_FUNCTION__> "virtual bool Field_int::get_date(MYSQL_TIME*, ulonglong)") at assert.c:92
#7  0x00007f30ac230c82 in __GI___assert_fail (assertion=0x555b05a8f480 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=0x555b05a8f270 "/home/alice/git/10.3/sql/field.cc", line=2068, function=0x555b05a909e0 <Field_int::get_date(st_mysql_time*, unsigned long long)::__PRETTY_FUNCTION__> "virtual bool Field_int::get_date(MYSQL_TIME*, ulonglong)") at assert.c:101
#8  0x0000555b04fd3610 in Field_int::get_date (this=0x7f309418bab0, ltime=0x7f30a63d3d00, fuzzydate=33554433) at /home/alice/git/10.3/sql/field.cc:2068
#9  0x0000555b0502d52b in Item_field::get_date_result (this=0x7f3094017850, ltime=0x7f30a63d3d00, fuzzydate=33554433) at /home/alice/git/10.3/sql/item.cc:3415
#10 0x0000555b05023200 in Item::val_datetime_packed_result (this=0x7f3094017850) at /home/alice/git/10.3/sql/item.cc:121
#11 0x0000555b05040ac3 in Item_cache_temporal::cache_value (this=0x7f3094136390) at /home/alice/git/10.3/sql/item.cc:10057
#12 0x0000555b050406a6 in Item_cache_temporal::val_datetime_packed (this=0x7f3094136390) at /home/alice/git/10.3/sql/item.cc:9981
#13 0x0000555b05061f11 in Item::val_temporal_packed (this=0x7f3094136390, f_type=MYSQL_TYPE_DATE) at /home/alice/git/10.3/sql/item.h:1483
#14 0x0000555b05052ed0 in Item_func_between::val_int_cmp_temporal (this=0x7f309406e570) at /home/alice/git/10.3/sql/item_cmpfunc.cc:2127
#15 0x0000555b04f00ae2 in Type_handler_temporal_result::Item_func_between_val_int (this=0x555b06556e88 <type_handler_newdate>, func=0x7f309406e570) at /home/alice/git/10.3/sql/sql_type.cc:3713
#16 0x0000555b0518c4fa in Item_func_between::val_int (this=0x7f309406e570) at /home/alice/git/10.3/sql/item_cmpfunc.h:901
#17 0x0000555b04f03e8f in Type_handler::Item_send_long (this=0x555b06556e00 <type_handler_long>, item=0x7f309406e570, protocol=0x7f3094001080, buf=0x7f30a63d3f50) at /home/alice/git/10.3/sql/sql_type.cc:5304
#18 0x0000555b04f08566 in Type_handler_long::Item_send (this=0x555b06556e00 <type_handler_long>, item=0x7f309406e570, protocol=0x7f3094001080, buf=0x7f30a63d3f50) at /home/alice/git/10.3/sql/sql_type.h:2415
#19 0x0000555b04c08ecc in Item::send (this=0x7f309406e570, protocol=0x7f3094001080, buffer=0x7f30a63d3f50) at /home/alice/git/10.3/sql/item.h:834
#20 0x0000555b04c03ea9 in Protocol::send_result_set_row (this=0x7f3094001080, row_items=0x7f30940051e0) at /home/alice/git/10.3/sql/protocol.cc:986
#21 0x0000555b04cad6ec in select_send::send_data (this=0x7f3094107180, items=...) at /home/alice/git/10.3/sql/sql_class.cc:3042
#22 0x0000555b04d88efe in end_send (join=0x7f3094183330, join_tab=0x7f30940dd1b0, end_of_records=false) at /home/alice/git/10.3/sql/sql_select.cc:20425
#23 0x0000555b04d86723 in evaluate_join_record (join=0x7f3094183330, join_tab=0x7f30940dce00, error=0) at /home/alice/git/10.3/sql/sql_select.cc:19465
#24 0x0000555b04d85fdb in sub_select (join=0x7f3094183330, join_tab=0x7f30940dce00, end_of_records=false) at /home/alice/git/10.3/sql/sql_select.cc:19244
#25 0x0000555b04d85502 in do_select (join=0x7f3094183330, procedure=0x0) at /home/alice/git/10.3/sql/sql_select.cc:18783
#26 0x0000555b04d5e83a in JOIN::exec_inner (this=0x7f3094183330) at /home/alice/git/10.3/sql/sql_select.cc:3996
#27 0x0000555b04d5dcaa in JOIN::exec (this=0x7f3094183330) at /home/alice/git/10.3/sql/sql_select.cc:3790
#28 0x0000555b04d5ef15 in mysql_select (thd=0x7f3094000a98, tables=0x7f3094076f40, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f3094107180, unit=0x7f3094004918, select_lex=0x7f30940050b0) at /home/alice/git/10.3/sql/sql_select.cc:4195
#29 0x0000555b04d50f3e in handle_select (thd=0x7f3094000a98, lex=0x7f3094004850, result=0x7f3094107180, setup_tables_done_option=0) at /home/alice/git/10.3/sql/sql_select.cc:382
#30 0x0000555b04d1ada2 in execute_sqlcom_select (thd=0x7f3094000a98, all_tables=0x7f3094076f40) at /home/alice/git/10.3/sql/sql_parse.cc:6545
#31 0x0000555b04d11068 in mysql_execute_command (thd=0x7f3094000a98) at /home/alice/git/10.3/sql/sql_parse.cc:3768
#32 0x0000555b04d1ea84 in mysql_parse (thd=0x7f3094000a98, rawbuf=0x7f30940fa0c0 "SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1", length=60, parser_state=0x7f30a63d55d0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.3/sql/sql_parse.cc:8019
#33 0x0000555b04d0ba67 in dispatch_command (command=COM_QUERY, thd=0x7f3094000a98, packet=0x7f309400a589 "", packet_length=60, is_com_multi=false, is_next_command=false) at /home/alice/git/10.3/sql/sql_parse.cc:1846
#34 0x0000555b04d0a484 in do_command (thd=0x7f3094000a98) at /home/alice/git/10.3/sql/sql_parse.cc:1391
#35 0x0000555b04e75149 in do_handle_one_connection (connect=0x555b07152f68) at /home/alice/git/10.3/sql/sql_connect.cc:1402
#36 0x0000555b04e74e9a in handle_one_connection (arg=0x555b07152f68) at /home/alice/git/10.3/sql/sql_connect.cc:1308
#37 0x0000555b0579d7fa in pfs_spawn_thread (arg=0x555b070b1ec8) at /home/alice/git/10.3/storage/perfschema/pfs.cc:1862
#38 0x00007f30ace756ba in start_thread (arg=0x7f30a63d6700) at pthread_create.c:333
#39 0x00007f30ac30a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109



 Comments   
Comment by Elena Stepanova [ 2018-06-18 ]

The variation of the test case below shows that the location of the failure can be moved (adding for making it more searchable):

CREATE TABLE t1 (pk int  default 0, a1 date);
INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL);
 
CREATE VIEW v1 AS 
SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1;
 
SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1;

Just ~ DEFAULT(pk) instead of DEFAULT(pk).

10.2 eb77f8cf8de

mysqld: /data/src/10.2/sql/field.cc:4235: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
180618 19:27:29 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f633740cee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005607e679e668 in Field_long::val_int (this=0x7f6314016ca8) at /data/src/10.2/sql/field.cc:4235
#9  0x00005607e67dfddc in Item_field::val_int (this=0x7f63140127f0) at /data/src/10.2/sql/item.cc:2792
#10 0x00005607e67f1644 in Item_default_value::val_int (this=0x7f63140127f0) at /data/src/10.2/sql/item.cc:8985
#11 0x00005607e68443e4 in Item_func_bit_neg::val_int (this=0x7f63140128f0) at /data/src/10.2/sql/item_func.cc:2284
#12 0x00005607e67dbc47 in Item::get_date (this=0x7f63140128f0, ltime=0x7f633169c5f0, fuzzydate=33554433) at /data/src/10.2/sql/item.cc:1346
#13 0x00005607e648d13b in Item::get_date_result (this=0x7f63140128f0, ltime=0x7f633169c5f0, fuzzydate=33554433) at /data/src/10.2/sql/item.h:1452
#14 0x00005607e67f4298 in Item_cache_temporal::cache_value (this=0x7f6314016e30) at /data/src/10.2/sql/item.cc:9802
#15 0x00005607e67f3e84 in Item_cache_temporal::val_datetime_packed (this=0x7f6314016e30) at /data/src/10.2/sql/item.cc:9720
#16 0x00005607e67f8b37 in Item::val_temporal_packed (this=0x7f6314016e30, f_type=MYSQL_TYPE_DATE) at /data/src/10.2/sql/item.h:1426
#17 0x00005607e6807ff1 in Item_func_between::val_int (this=0x7f63140129b0) at /data/src/10.2/sql/item_cmpfunc.cc:2173
#18 0x00005607e67ebc37 in Item::send (this=0x7f63140129b0, protocol=0x7f63140010b8, buffer=0x7f633169c900) at /data/src/10.2/sql/item.cc:7012
#19 0x00005607e6488b92 in Protocol::send_result_set_row (this=0x7f63140010b8, row_items=0x7f6314004f00) at /data/src/10.2/sql/protocol.cc:979
#20 0x00005607e650ac88 in select_send::send_data (this=0x7f63140159b0, items=...) at /data/src/10.2/sql/sql_class.cc:2800
#21 0x00005607e65c47aa in end_send (join=0x7f63140159d0, join_tab=0x7f6314017e78, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:19881
#22 0x00005607e65c2286 in evaluate_join_record (join=0x7f63140159d0, join_tab=0x7f6314017ac8, error=0) at /data/src/10.2/sql/sql_select.cc:18933
#23 0x00005607e65c1b90 in sub_select (join=0x7f63140159d0, join_tab=0x7f6314017ac8, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18713
#24 0x00005607e65c1129 in do_select (join=0x7f63140159d0, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18257
#25 0x00005607e659b81d in JOIN::exec_inner (this=0x7f63140159d0) at /data/src/10.2/sql/sql_select.cc:3587
#26 0x00005607e659acca in JOIN::exec (this=0x7f63140159d0) at /data/src/10.2/sql/sql_select.cc:3382
#27 0x00005607e659be95 in mysql_select (thd=0x7f6314000b00, tables=0x7f6314012be8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f63140159b0, unit=0x7f63140046a0, select_lex=0x7f6314004dd8) at /data/src/10.2/sql/sql_select.cc:3782
#28 0x00005607e6590383 in handle_select (thd=0x7f6314000b00, lex=0x7f63140045d8, result=0x7f63140159b0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:376
#29 0x00005607e655bb6f in execute_sqlcom_select (thd=0x7f6314000b00, all_tables=0x7f6314012be8) at /data/src/10.2/sql/sql_parse.cc:6474
#30 0x00005607e6551b9c in mysql_execute_command (thd=0x7f6314000b00) at /data/src/10.2/sql/sql_parse.cc:3480
#31 0x00005607e655f999 in mysql_parse (thd=0x7f6314000b00, rawbuf=0x7f6314012448 "SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1", length=62, parser_state=0x7f633169e200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7999
#32 0x00005607e654d442 in dispatch_command (command=COM_QUERY, thd=0x7f6314000b00, packet=0x7f631416b361 "", packet_length=62, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1821
#33 0x00005607e654bda5 in do_command (thd=0x7f6314000b00) at /data/src/10.2/sql/sql_parse.cc:1375
#34 0x00005607e669c44e in do_handle_one_connection (connect=0x5607e9bb7370) at /data/src/10.2/sql/sql_connect.cc:1335
#35 0x00005607e669c1db in handle_one_connection (arg=0x5607e9bb7370) at /data/src/10.2/sql/sql_connect.cc:1241
#36 0x00005607e6abd38c in pfs_spawn_thread (arg=0x5607e9c5e730) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#37 0x00007f63390e3494 in start_thread (arg=0x7f633169f700) at pthread_create.c:333
#38 0x00007f63374c993f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Comment by Elena Stepanova [ 2018-07-16 ]

Raising to critical because it affects tests rather badly.

Comment by Alexander Barkov [ 2018-07-25 ]

The problem happens because the expression corresponding to (~DEFAULT(pk)) gets converted from Item_default_value to Item_cache_temporal, and this cache get written to Item_func_between::args[].

So Item_func_between::update_used_tables() gets when asks args[x]->used_tables() from Item_cache_temporal.

Comment by Oleksandr Byelkin [ 2018-08-07 ]

some possible solution:
diff --git a/sql/item.h b/sql/item.h
index 8fad8dadf22..27414805cee 100644
— a/sql/item.h
+++ b/sql/item.h
@@ -5649,6 +5649,17 @@ class Item_cache: public Item_basic_constant,
example->split_sum_func2(thd, ref_pointer_array, fields, &example, flags);
}
Item *get_example() const

{ return example; }

+ /*
+ virtual table_map used_tables() const
+

{ return example ? example->used_tables() : (table_map) 0L; }

+ */
+ /*
+ virtual void update_used_tables()
+

{ + if (example) + return example->update_used_tables(); + }

+ */

virtual Item *convert_to_basic_const_item(THD *thd)

{ return 0; }

;
Item *derived_field_transformer_for_having(THD *thd, uchar *arg)

need to check mpore how it behave with constant tables

Comment by Oleksandr Byelkin [ 2018-08-07 ]

revision-id: 1e8b79d966fca2ae541477972ac759be5ee60c4e (mariadb-10.2.16-66-g1e8b79d966f)
parent(s): 4ddcb4eb46c62cf459936554d43351db740ba14d
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-08-07 15:28:58 +0200
message:

MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date

Provide possibility for constant function like DEFAULT() still mark tables as being read.

Comment by Oleksandr Byelkin [ 2018-08-08 ]

revision-id: 6df4e4a855fe223988c12681f8caec6c49b2f629 (mariadb-10.2.16-66-g6df4e4a855f)
parent(s): 4ddcb4eb46c62cf459936554d43351db740ba14d
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-08-08 12:28:15 +0200
message:

MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date

  • clean up DEFAULT() to work only with default value and correctly print
    itself.
  • fix of DBUG_ASSERT about fields read/write
  • fix of firld marking for write based really on the thd->mark_used_columns flag

Comment by Oleksandr Byelkin [ 2018-11-07 ]

revision-id: 031efde365c674dbdbaada95aa6d42a4274db438 (mariadb-10.2.18-65-g031efde365c)
parent(s): 89f948c766721a26e110bc9da0ca5ebc20f65112
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-11-07 14:29:47 +0100
message:

MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date

  • clean up DEFAULT() to work only with default value and correctly print
    itself.
  • fix of DBUG_ASSERT about fields read/write
  • fix of field marking for write based really on the thd->mark_used_columns flag

Comment by Oleksandr Byelkin [ 2018-11-13 ]

revision-id: 10807fe95db791b6e1ac0f14e945de080f24d108 (mariadb-10.2.18-65-g10807fe95db)
parent(s): 89f948c766721a26e110bc9da0ca5ebc20f65112
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-11-13 11:15:20 +0100
message:

MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date

  • clean up DEFAULT() to work only with default value and correctly print
    itself.
  • fix of DBUG_ASSERT about fields read/write
  • fix of field marking for write based really on the thd->mark_used_columns flag

Comment by Sergei Golubchik [ 2018-11-13 ]

ok to push

Generated at Thu Feb 08 08:27:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.