[MDEV-16992] Assertion `table_ref->table || table_ref->view' failed in Field_iterator_table_ref::set_field_iterator Created: 2018-08-15 Updated: 2018-12-11 Resolved: 2018-09-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - CTE |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.2.18, 10.3.10, 10.4.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alice Sherepa | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
mysqld: /10.4/sql/table.cc:6050: void Field_iterator_table_ref::set_field_iterator(): Assertion `table_ref->table || table_ref->view' failed.
|
| Comments |
| Comment by Igor Babaev [ 2018-08-21 ] | |||||||||||||||||||||||||||||||||||||
|
We have a similar failure for the following prepare statement
This sequence of commands triggers the same assertion failure
| |||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-08-22 ] | |||||||||||||||||||||||||||||||||||||
|
This bug happens because the calls open_normal_and_derived_tables() in the functions
lack the flag DT_INIT in the last parameter. | |||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2018-08-31 ] | |||||||||||||||||||||||||||||||||||||
|
adding just to make it searchable, got the same assertion, does not fail after d8b8079e421a7d19d3e0 commit
| |||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-09-07 ] | |||||||||||||||||||||||||||||||||||||
|
Here's the explanation why the reported statement fail in 10.4 and do not fail in 10.2 and 10.2. In 10.4 for the first reported statement
The order of SELECTs in LEX::all_select_list is as follows:
This order determines the order in which context analysis of SELECTs is performed. In 10.2 we have the following order of SELECTs in LEX::all_select_list ;
Here mysql_derived_prepare() first is called for the derived tables of select `` AS `` from (select 1 AS `1`) t. In this case t is not marked as derived, mysql_derived_prepare() sees that there is a unit specifying this table. So t is handled as derived and a call of TABLE_LIST::init() derived marks it as such. | |||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-09-07 ] | |||||||||||||||||||||||||||||||||||||
|
A fix for this bug was pushed into 10.2,10.3,10.4. |