• unknown's avatar
    Fix for bug #6849 "Crash while preparing query containing const expr with · bc152db5
    unknown authored
    IN and CONVERT_TZ()" (with after review changes).
    
    Now we add implicitly used time zone tables to global table list right
    at the parsing stage instead of doing it later in mysql_execute_command()
    or in check_prepared_statement().
    
    No special test-case needed since this bug also manifests itself as
    timezone2.test failure if one runs it with --ps-protocol option.
    
    
    sql/sql_base.cc:
      relink_tables_for_multidelete(): 
       presence of implicitly used time zone tables is no longer condition for
       propagation of TABLE pointers from global table list to local table
       lists (since now global list is always created...)
    sql/sql_lex.cc:
      - Added LEX::add_time_zone_tables_to_query_tables() function which adds
        implicitly used time zone tables to global table list.
      - Definition of fake_time_zone_tables_list moved to tztime.cc, since
        it is no longer used in parser.
    sql/sql_lex.h:
      - Since now we add implicitly used time zone tables right at parsing
        stage, LEX::time_zone_tables_used is either zero or points to valid
        time zone tables list. Updated its description to reflect that.
      - Added LEX::add_time_zone_tables_to_query_tables() function which adds
        implicitly used time zone tables to global table list.
      - Declaration of fake_time_zone_tables_list moved to tztime.h,
        since it is no longer used in parser.
    sql/sql_parse.cc:
      mysql_execute_command():
        Removed adding list of implicitly used time zone tables to global table
        list, since now we do this right at the parsing stage.
    sql/sql_yacc.yy:
      Let us add implicitly used time zone tables to global table list
      right at the parsing stage instead of doing it later in
      mysql_execute_command() or in check_prepared_statement().
    sql/tztime.cc:
      Moved fake_time_zone_tables_list definition from sql_lex.cc to
      tztime.cc since now it is used only for error reporting from
      my_tz_get_table_list() function.
    sql/tztime.h:
      Moved fake_time_zone_tables_list declaration from sql_lex.h to
      tztime.h since now it is used only for error reporting from
      my_tz_get_table_list() function.
    bc152db5
sql_base.cc 103 KB