Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11364

Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_newdate::val_real()

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (t TIME, d DATE NOT NULL);
      INSERT INTO t1 VALUES ('10:00:00', '0000-00-00'),('11:00:00','0000-00-00');
       
      SET OPTIMIZER_USE_CONDITION_SELECTIVITY = 4, HISTOGRAM_SIZE = 255, USE_STAT_TABLES = PREFERABLY;
       
      ANALYZE TABLE t1;
      SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq;
      

      10.0 03ddc19ab2

      mysqld: /data/src/10.0/sql/field.cc:5878: virtual double Field_newdate::val_real(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
      161128  2:15:34 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f1023856312 in __GI___assert_fail (assertion=0xf366e8 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=0xf36575 "/data/src/10.0/sql/field.cc", line=5878, function=0xf39800 <Field_newdate::val_real()::__PRETTY_FUNCTION__> "virtual double Field_newdate::val_real()") at assert.c:101
      #8  0x0000000000815c47 in Field_newdate::val_real (this=0x7f101c028078) at /data/src/10.0/sql/field.cc:5878
      #9  0x0000000000806c37 in Field::pos_in_interval_val_real (this=0x7f101c028078, min=0x7f101c027c60, max=0x7f101da2e588) at /data/src/10.0/sql/field.cc:1155
      #10 0x00000000008258b3 in Field_temporal::pos_in_interval (this=0x7f101c028078, min=0x7f101c027c60, max=0x7f101da2e588) at /data/src/10.0/sql/field.h:1660
      #11 0x00000000006e2a64 in get_column_range_cardinality (field=0x7f101c028078, min_endp=0x7f1025b19530, max_endp=0x7f1025b19550, range_flag=16) at /data/src/10.0/sql/sql_statistics.cc:3673
      #12 0x0000000000945bed in records_in_column_ranges (param=0x7f1025b19b90, idx=0, tree=0x7f101c3fc0c0) at /data/src/10.0/sql/opt_range.cc:3448
      #13 0x0000000000946492 in calculate_cond_selectivity_for_table (thd=0x7f101efdd070, table=0x7f101c09e470, cond=0x7f101c14ea20) at /data/src/10.0/sql/opt_range.cc:3683
      #14 0x0000000000686dc0 in make_join_statistics (join=0x7f101c14dcb0, tables_list=..., conds=0x7f101c14ea20, keyuse_array=0x7f101c14dfc8) at /data/src/10.0/sql/sql_select.cc:3964
      #15 0x000000000067dd39 in JOIN::optimize_inner (this=0x7f101c14dcb0) at /data/src/10.0/sql/sql_select.cc:1339
      #16 0x000000000067cc4e in JOIN::optimize (this=0x7f101c14dcb0) at /data/src/10.0/sql/sql_select.cc:1024
      #17 0x00000000006849c3 in mysql_select (thd=0x7f101efdd070, rref_pointer_array=0x7f101efe1378, tables=0x7f101c14d6d0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f101c0fbd68, unit=0x7f101efe0a10, select_lex=0x7f101efe1100) at /data/src/10.0/sql/sql_select.cc:3294
      #18 0x000000000067ae12 in handle_select (thd=0x7f101efdd070, lex=0x7f101efe0948, result=0x7f101c0fbd68, setup_tables_done_option=0) at /data/src/10.0/sql/sql_select.cc:373
      #19 0x000000000064f6d0 in execute_sqlcom_select (thd=0x7f101efdd070, all_tables=0x7f101c14d6d0) at /data/src/10.0/sql/sql_parse.cc:5288
      #20 0x0000000000647c10 in mysql_execute_command (thd=0x7f101efdd070) at /data/src/10.0/sql/sql_parse.cc:2563
      #21 0x0000000000652350 in mysql_parse (thd=0x7f101efdd070, rawbuf=0x7f101c0fa088 "SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq", length=51, parser_state=0x7f1025b1b650) at /data/src/10.0/sql/sql_parse.cc:6570
      #22 0x0000000000644e66 in dispatch_command (command=COM_QUERY, thd=0x7f101efdd070, packet=0x7f101efd3071 "SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq", packet_length=51) at /data/src/10.0/sql/sql_parse.cc:1309
      #23 0x0000000000644129 in do_command (thd=0x7f101efdd070) at /data/src/10.0/sql/sql_parse.cc:999
      #24 0x000000000076251c in do_handle_one_connection (thd_arg=0x7f101efdd070) at /data/src/10.0/sql/sql_connect.cc:1378
      #25 0x000000000076228e in handle_one_connection (arg=0x7f101efdd070) at /data/src/10.0/sql/sql_connect.cc:1293
      #26 0x00000000009fb5de in pfs_spawn_thread (arg=0x7f101d991370) at /data/src/10.0/storage/perfschema/pfs.cc:1860
      #27 0x00007f10257580a4 in start_thread (arg=0x7f1025b1c700) at pthread_create.c:309
      #28 0x00007f102391087d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Another variation for 10.1, very similar but in a different place, please make sure that both are fixed:

      CREATE TABLE t1 (t TIME, d DATETIME NOT NULL);
      INSERT INTO t1 VALUES ('00:20:01','0000-00-00 00:00:00'),('00:20:05','0000-00-00 00:00:00');
       
      SET OPTIMIZER_USE_CONDITION_SELECTIVITY = 4, HISTOGRAM_SIZE = 255, USE_STAT_TABLES = PREFERABLY;
       
      ANALYZE TABLE t1;
      SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq;
      

      10.1 a68d1352b6

      mysqld: /data/src/10.1/sql/field.cc:6781: virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, ulonglong) const: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
      161128  2:40:36 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f5b34bef312 in __GI___assert_fail (assertion=0x7f5b37dc3a50 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=0x7f5b37dc3814 "/data/src/10.1/sql/field.cc", line=6781, function=0x7f5b37dc7840 <Field_datetimef::get_TIME(st_mysql_time*, unsigned char const*, unsigned long long) const::__PRETTY_FUNCTION__> "virtual bool Field_datetimef::get_TIME(MYSQL_TIME*, const uchar*, ulonglong) const") at assert.c:101
      #8  0x00007f5b37612a49 in Field_datetimef::get_TIME (this=0x7f5b2bca0190, ltime=0x7f5b383101a0, pos=0x7f5b2bca008c "\200", fuzzydate=0) at /data/src/10.1/sql/field.cc:6781
      #9  0x00007f5b376239ea in Field_datetimef::get_date (this=0x7f5b2bca0190, ltime=0x7f5b383101a0, fuzzydate=0) at /data/src/10.1/sql/field.h:2744
      #10 0x00007f5b37612648 in Field_datetime_with_dec::val_real (this=0x7f5b2bca0190) at /data/src/10.1/sql/field.cc:6707
      #11 0x00007f5b375ffeef in Field::pos_in_interval_val_real (this=0x7f5b2bca0190, min=0x7f5b2dbd3878, max=0x7f5b2bc9fb88) at /data/src/10.1/sql/field.cc:1124
      #12 0x00007f5b37622067 in Field_temporal::pos_in_interval (this=0x7f5b2bca0190, min=0x7f5b2dbd3878, max=0x7f5b2bc9fb88) at /data/src/10.1/sql/field.h:2118
      #13 0x00007f5b374a0f5b in get_column_range_cardinality (field=0x7f5b2bca0190, min_endp=0x7f5b38310390, max_endp=0x7f5b383103b0, range_flag=16) at /data/src/10.1/sql/sql_statistics.cc:3673
      #14 0x00007f5b3775107f in records_in_column_ranges (param=0x7f5b38310a70, idx=0, tree=0x7f5b2bd9e0c8) at /data/src/10.1/sql/opt_range.cc:2860
      #15 0x00007f5b377519ff in calculate_cond_selectivity_for_table (thd=0x7f5b2dbfa070, table=0x7f5b2bc81c70, cond=0x7f5b2bc45e70) at /data/src/10.1/sql/opt_range.cc:3096
      #16 0x00007f5b3743f288 in make_join_statistics (join=0x7f5b2bc45a28, tables_list=..., keyuse_array=0x7f5b2bc45d58) at /data/src/10.1/sql/sql_select.cc:4112
      #17 0x00007f5b3743552b in JOIN::optimize_inner (this=0x7f5b2bc45a28) at /data/src/10.1/sql/sql_select.cc:1361
      #18 0x00007f5b37434416 in JOIN::optimize (this=0x7f5b2bc45a28) at /data/src/10.1/sql/sql_select.cc:1040
      #19 0x00007f5b3743ca52 in mysql_select (thd=0x7f5b2dbfa070, rref_pointer_array=0x7f5b2dbfe430, tables=0x7f5b2bc452d0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f5b2bc45a08, unit=0x7f5b2dbfdab8, select_lex=0x7f5b2dbfe1b8) at /data/src/10.1/sql/sql_select.cc:3424
      #20 0x00007f5b374325d6 in handle_select (thd=0x7f5b2dbfa070, lex=0x7f5b2dbfd9f0, result=0x7f5b2bc45a08, setup_tables_done_option=0) at /data/src/10.1/sql/sql_select.cc:384
      #21 0x00007f5b374027ad in execute_sqlcom_select (thd=0x7f5b2dbfa070, all_tables=0x7f5b2bc452d0) at /data/src/10.1/sql/sql_parse.cc:5896
      #22 0x00007f5b373f86cf in mysql_execute_command (thd=0x7f5b2dbfa070) at /data/src/10.1/sql/sql_parse.cc:2968
      #23 0x00007f5b37405f06 in mysql_parse (thd=0x7f5b2dbfa070, rawbuf=0x7f5b2bc43088 "SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq", length=51, parser_state=0x7f5b383125e0) at /data/src/10.1/sql/sql_parse.cc:7319
      #24 0x00007f5b373f48d9 in dispatch_command (command=COM_QUERY, thd=0x7f5b2dbfa070, packet=0x7f5b2f53e071 "SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq", packet_length=51) at /data/src/10.1/sql/sql_parse.cc:1487
      #25 0x00007f5b373f3610 in do_command (thd=0x7f5b2dbfa070) at /data/src/10.1/sql/sql_parse.cc:1108
      #26 0x00007f5b375296f5 in do_handle_one_connection (thd_arg=0x7f5b2dbfa070) at /data/src/10.1/sql/sql_connect.cc:1350
      #27 0x00007f5b37529459 in handle_one_connection (arg=0x7f5b2dbfa070) at /data/src/10.1/sql/sql_connect.cc:1262
      #28 0x00007f5b3780c5bc in pfs_spawn_thread (arg=0x7f5b34027ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1860
      #29 0x00007f5b36af10a4 in start_thread (arg=0x7f5b38313b00) at pthread_create.c:309
      #30 0x00007f5b34ca987d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

        Attachments

          Activity

            People

            Assignee:
            igor Igor Babaev
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: