• unknown's avatar
    Cleanup patch for handling of subselects in commands which cannot · 2e1bfbd2
    unknown authored
    handle them.
    
    Problem:
    CREATE|ALTER EVENT, HANDLER READ, KILL, Partitioning uses `expr` from the
    parser. This rule comes with all the rings and bells including subqueries.
    However, these commands are not subquery safe. For this reason there are two
    fuse checks in the parser. They were checking by command id. CREATE EVENT
    should forbid subquery is the fix for
    bug#16394 Events: Crash if schedule contains SELECT
    The fix has been incorporated as part of the patch for WL#3337 (Event scheduler
    new architecture).
    
    Solution:
    A new flag was added to LEX command_forbids_subselect. The fuse checks were
    changed. The commands are responsible to set the value to true whenever
    they can't handle subselects.
    
    
    sql/sql_lex.cc:
      initialize the variable
    sql/sql_lex.h:
      Add a new flag whether the parser should allow a subselect when
      parsing. This is temporarily turned off by commands like CREATE|ALTER EVENT,
      HA_READ, KILL. Could be used by other parts which reuse `expr` rule of the
      grammar and should not allow subqueries as part of it.
    sql/sql_yacc.yy:
      Forbid subselects in some commands in a better way.
      CREATE|ALTER EVENT, HANDLER READ, KILL, are not subselect
      safe for parameters and therefore they should be forbidden already in
      the parser.
      This patch makes it easier for the developer to add new commands in that
      sense similar to the mentioned above.
    2e1bfbd2
sql_lex.h 39.6 KB