15:30 — Writing summary for 18th June report
15:40 — Done with summary.
15:50 — Following test case crashes:
with cte1 as (select * from v1), cte2 as (select * from cte1)
update cte2 set a=11 where a>5;
/* ERROR:
mysqld: /home/rahul/MariaDB/MDEV-18511-Rahul-Anand/sql/mdl.h:558:
void MDL_request::set_type(enum_mdl_type): Assertion `ticket == __null' failed.
*/
15:53 — Going to investigate this crash in debugger.
15:53 — global table list order: cte2→v1→cte1. This makes sense because 'derived' member for CTE is not set during parsing phase.
16:04 — I am thinking of adding a case for with element in 'add_to_query_tables'.
16:12 — Rebuilding server.
16:20 — Shifting the code to 'add_table_to_list' to just set ptr→derived so 'add_to_query_tables' can be used as it is. Also rebuilding server.
16:42 — Finished Building. Let's check the order.
Order is still cte2→v1→cte1
Okay. ptr→with is not set initially.
16:54 — p dbug_print_select(..) causes SIGSEGV inside add_table_to_list.
// Code I added
if ((ptr->with= ptr->select_lex->find_table_def_in_with_clauses(ptr)))
ptr->set_as_with_table(thd,ptr->with);
/* Link table in global list (all used tables) */
lex->add_to_query_tables(ptr);
17:08 — select_lex→master_unit() = 0x0. This is the reason of Segmentation fault. Now, question becomes that how to differentiate between a base table and a CTE element if you cannot set with.
17:18 — Checking few things in debugger to differentiate.
17:23 — derived member of TABLE_LIST object is not set for views and ctes i.e table→derived = 0
17:30 — Can't find a way to differentiate between the two. DISCUSS THIS WITH IGOR.
17:31 — Going for a break.
17:55 — Back to work. Let's start working on task 2 "Continue adding queries for single-table updates from derived_queries". I am assuming he meant adding to derived_queries.test because adding non-working queries to with_update has no benefit.