[MDEV-5446] Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' fails on EXPLAIN EXTENDED with VALUES function Created: 2013-12-14  Updated: 2014-03-14  Resolved: 2014-03-14

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.34, 10.0.6
Fix Version/s: 5.5.37, 10.0.10, 5.3.13

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 Description   

Setting to minor because it's a debug assertion, constant table and a rather meaningless use of VALUES function.

CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,10);
CREATE VIEW v1 AS SELECT * FROM t1;
 
EXPLAIN EXTENDED SELECT VALUES(b) FROM v1;

mysqld: field.cc:3675: virtual String* Field_long::val_str(String*, String*): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
131214  3:03:08 [ERROR] mysqld got signal 6 ;

#6  0x00007fbbc958a621 in *__GI___assert_fail (assertion=0xcb8a70 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=<optimized out>, line=3675, function=0xcbbd60 "virtual String* Field_long::val_str(String*, String*)") at assert.c:81
#7  0x000000000065e128 in Field_long::val_str (this=0x21dfa30, val_buffer=0x7fbbc0aa6410, val_ptr=0x21b84e0) at field.cc:3675
#8  0x00000000005a5aa4 in Item_field::val_str (this=0x21b84c8, str=0x7fbbc0aa6410) at item.cc:2384
#9  0x00000000005a0b6f in Item::print_value (this=0x21b84c8, str=0x7fbbc0aa68c0) at item.cc:585
#10 0x00000000005afc1c in Item_field::print (this=0x21b84c8, str=0x7fbbc0aa68c0, query_type=QT_ORDINARY) at item.cc:6209
#11 0x00000000005b49b9 in Item_insert_value::print (this=0x21b6ad0, str=0x7fbbc0aa68c0, query_type=QT_ORDINARY) at item.cc:7897
#12 0x00000000005a0aa3 in Item::print_item_w_name (this=0x21b6ad0, str=0x7fbbc0aa68c0, query_type=QT_ORDINARY) at item.cc:570
#13 0x0000000000761ac9 in st_select_lex::print (this=0x2135660, thd=0x2132bc8, str=0x7fbbc0aa68c0, query_type=QT_ORDINARY) at sql_select.cc:22700
#14 0x0000000000587ea6 in st_select_lex_unit::print (this=0x2135158, str=0x7fbbc0aa68c0, query_type=QT_ORDINARY) at sql_lex.cc:2106
#15 0x00000000006b4c95 in execute_sqlcom_select (thd=0x2132bc8, all_tables=0x21b6c40) at sql_parse.cc:5157
#16 0x00000000006abf50 in mysql_execute_command (thd=0x2132bc8) at sql_parse.cc:2305
#17 0x00000000006b771b in mysql_parse (thd=0x2132bc8, rawbuf=0x21b6900 "EXPLAIN EXTENDED SELECT VALUES(b) FROM v1", length=41, found_semicolon=0x7fbbc0aa7cb8) at sql_parse.cc:6173
#18 0x00000000006a9730 in dispatch_command (command=COM_QUERY, thd=0x2132bc8, packet=0x21ad499 "", packet_length=41) at sql_parse.cc:1243
#19 0x00000000006a8a1c in do_command (thd=0x2132bc8) at sql_parse.cc:923
#20 0x00000000006a58a5 in handle_one_connection (arg=0x2132bc8) at sql_connect.cc:1231
#21 0x00007fbbca296b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#22 0x00007fbbc9639a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

revision-id: igor@askmonty.org-20131212215533-9n040xfc9onhho5o
revno: 3736
branch-nick: 5.3



 Comments   
Comment by Elena Stepanova [ 2014-03-04 ]

Raising the priority because it might affect other EXPLAIN EXTENDED queries, not just those with VALUES(..), and minor issues don't even get analyzed.

Comment by Oleksandr Byelkin [ 2014-03-13 ]

In the SELECT list we see Field object which do not belong to table in refer (probably it is a copy) with wrong field_index.

Comment by Oleksandr Byelkin [ 2014-03-13 ]

The problem is in Item_insert_value::fix_fields trick by creating null field.

Comment by Oleksandr Byelkin [ 2014-03-13 ]

The patch send for review.

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