• unknown's avatar
    Fix bug #14138 ROLLUP and PROCEDURE ANALYSE() hang server · a7ed6ce4
    unknown authored
    Procedure analyse() redefines select's fields_list. setup_copy_fields() assumes
    that fields_list is a part of all_fields_list. Because select have only 
    3 columns and analyse() redefines it to have 10 columns, int overrun in
    setup_copy_fields() occurs and server goes to almost infinite loop.
    
    Because fields_list used not only to send data ad fields types, it's wrong 
    to allow procedure redefine it. This patch separates select's fileds_list 
    and procedure's one. Now if procedure is present, copy of fields_list is 
    created in procedure_fields_list and it is used for sending data and fields.
    
    
    mysql-test/t/analyse.test:
      Test case for bug #14138  ROLLUP and PROCEDURE ANALYSE() hang server
    mysql-test/r/analyse.result:
      Test case for bug #14138  ROLLUP and PROCEDURE ANALYSE() hang server
    sql/sql_select.h:
      Fix bug #14138  ROLLUP and PROCEDURE ANALYSE() hang server
      To JOIN  Added separate fields_list for procedure.
    sql/sql_select.cc:
      Fix bug #14138  ROLLUP and PROCEDURE ANALYSE() hang server
      SELECT's fields_list and procedure's fields_list made split. If procedure is defined
      then procedure's fields_list is used to send fields and data.
    a7ed6ce4
sql_select.cc 288 KB