• Gleb Shchepa's avatar
    Bug #41156: List of derived tables acts like a chain of · 8b278847
    Gleb Shchepa authored
                mutually-nested subqueries
    
    Queries of the form
    
      SELECT * FROM (SELECT 1) AS t1,
                    (SELECT 2) AS t2,...
                    (SELECT 32) AS t32
    
    caused the "Too high level of nesting for select" error
    as if the query has a form
    
      SELECT * FROM (SELECT 1 FROM (SELECT 2 FROM (SELECT 3 FROM...
    
    
    The table_factor parser rule has been modified to adjust
    the LEX::nest_level variable value after every derived table.
    
    
    mysql-test/r/derived.result:
      Added test case for bug #41156.
    mysql-test/t/derived.test:
      Added test case for bug #41156.
    sql/sql_yacc.yy:
      Bug #41156: List of derived tables acts like a chain of
                  mutually-nested subqueries
      
      The select_derived2 parser rule calls mysql_new_select()
      calls push_context() and nest_level++, however only
      the pop_context() was called at the end of derived table
      parsing at the table_factor rule.
      
      The table_factor parser rule has been modified to adjust
      the LEX::nest_level variable value after every derived table.
    8b278847
sql_yacc.yy 400 KB