Details
Description
Run these queries in debug build:
CREATE TABLE t0 ( c26 INT , CONSTRAINT cc0 UNIQUE i0 ( c26 ) ) ;
INSERT INTO t0 VALUES ( 120 ) , ( -60 ) ;
CREATE VIEW v0 AS SELECT c26 AS c43 , c26 AS c7 , -90 AS c10 FROM t0 ;
WITH t1 AS ( SELECT -4 AS c4 , 352814400749889744 AS c17 ) SELECT t3 . c17 AS c52 FROM t1 JOIN ( SELECT c4 AS c40 FROM t1 ) AS t2 JOIN t1 AS t3 ON DEFAULT ( t2 . c40 ) = t3 . c4 ON t2 . c40 = t3 . c17 WHERE t1 . c4 = -10 ;
Will trigger Assertion Failed.
GDB info:
#0 0x00007ffff6c0c00b in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff6beb859 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6beb729 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff6bfcfd6 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x000055555701971b in find_field_in_table_ref (thd=0x62c0001e0288, table_list=0x6290000f89d8, name=0x0, length=0, item_name=0x0, db_name=0x0, table_name=0x0, ignored_tables=0x0, ref=0x6290001c8690, check_privileges=true, allow_rowid=false, cached_field_index_ptr=0x6290001c85d0, register_tree_change=true, actual_table=0x7fffd1629e00) at /home/wx/mariadb-11.3.0/sql/sql_base.cc:6454
#5 0x000055555701bb61 in find_field_in_tables (thd=0x62c0001e0288, item=0x6290001c84e0, first_table=0x6290000f89d8, last_table=0x0, ignored_tables=0x0, ref=0x6290001c8690, report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true) at /home/wx/mariadb-11.3.0/sql/sql_base.cc:6833
#6 0x0000555557b9f4b8 in Item_field::fix_fields (this=0x6290001c84e0, thd=0x62c0001e0288, reference=0x6290001c8690) at /home/wx/mariadb-11.3.0/sql/item.cc:6013
#7 0x0000555556f0404f in Item::fix_fields_if_needed (this=0x6290001c84e0, thd=0x62c0001e0288, ref=0x6290001c8690) at /home/wx/mariadb-11.3.0/sql/item.h:1147
#8 0x0000555557c6c9f2 in Item_func::fix_fields (this=0x6290001c8608, thd=0x62c0001e0288, ref=0x6290001c54e0) at /home/wx/mariadb-11.3.0/sql/item_func.cc:349
#9 0x00005555572bf5f9 in JOIN::optimize_inner (this=0x6290001c5048) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2309
#10 0x00005555572bbba6 in JOIN::optimize (this=0x6290001c5048) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
#11 0x00005555570d7fb4 in mysql_derived_optimize (thd=0x62c0001e0288, lex=0x62c0001e45f8, derived=0x6290001862a8) at /home/wx/mariadb-11.3.0/sql/sql_derived.cc:1037
#12 0x00005555570d27b6 in mysql_handle_single_derived (lex=0x62c0001e45f8, derived=0x6290001862a8, phases=4) at /home/wx/mariadb-11.3.0/sql/sql_derived.cc:200
#13 0x00005555572c10e1 in JOIN::optimize_inner (this=0x6290001c2ae8) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2442
#14 0x00005555572bbba6 in JOIN::optimize (this=0x6290001c2ae8) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
#15 0x00005555572dd9ba in mysql_select (thd=0x62c0001e0288, tables=0x6290000f6c48, fields=..., conds=0x629000188640, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2165049856, result=0x6290001c1140, unit=0x62c0001e46d8, select_lex=0x6290000f6598) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:5235
#16 0x00005555572ad18a in handle_select (thd=0x62c0001e0288, lex=0x62c0001e45f8, result=0x6290001c1140, setup_tables_done_option=0) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:628
#17 0x00005555571ce583 in execute_sqlcom_select (thd=0x62c0001e0288, all_tables=0x6290000f6c48) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:6013
#18 0x00005555571becf6 in mysql_execute_command (thd=0x62c0001e0288, is_called_from_prepared_stmt=false) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:3912
#19 0x00005555571d95e2 in mysql_parse (thd=0x62c0001e0288, rawbuf=0x6290000f52a8 "WITH t1 AS ( SELECT -4 AS c4 , 352814400749889744 AS c17 ) SELECT t3 . c17 AS c52 FROM t1 JOIN ( SELECT c4 AS c40 FROM t1 ) AS t2 JOIN t1 AS t3 ON DEFAULT ( t2 . c40 ) = t3 . c4 ON t2 . c40 = t3 . c17"..., length=220, parser_state=0x7fffd162c870) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:7734
#20 0x00005555571b1237 in dispatch_command (command=COM_QUERY, thd=0x62c0001e0288, packet=0x6290000fa289 "WITH t1 AS ( SELECT -4 AS c4 , 352814400749889744 AS c17 ) SELECT t3 . c17 AS c52 FROM t1 JOIN ( SELECT c4 AS c40 FROM t1 ) AS t2 JOIN t1 AS t3 ON DEFAULT ( t2 . c40 ) = t3 . c4 ON t2 . c40 = t3 . c17"..., packet_length=223, blocking=true) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1893
#21 0x00005555571adf7c in do_command (thd=0x62c0001e0288, blocking=true) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1406
#22 0x000055555768e557 in do_handle_one_connection (connect=0x61100002c948, put_in_cache=true) at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1445
#23 0x000055555768deb4 in handle_one_connection (arg=0x61100002c808) at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1347
#24 0x00005555582fa350 in pfs_spawn_thread (arg=0x618000006d08) at /home/wx/mariadb-11.3.0/storage/perfschema/pfs.cc:2201
#25 0x00007ffff7115609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#26 0x00007ffff6ce8133 in clone () from /lib/x86_64-linux-gnu/libc.so.6