• Sergey Glukhov's avatar
    Bug#47371 reference by same column name · 1cffb859
    Sergey Glukhov authored
    At the end of execution top level join execution
    we cleanup this join with true argument.
    It leads to underlying join cleanup(subquery) with true argument too
    and to tmp_table_param->field array cleanup which is required later.
    The problem is that Item_func_set_user_var does not set
    result_filed which leads to unnecessary repeated excution of subquery
    on final stage.
    The fix is to set result_field for Item_func_set_user_var.
    
    
    mysql-test/r/count_distinct.result:
      test result
    mysql-test/r/user_var.result:
      test result
    mysql-test/t/count_distinct.test:
      test case
    mysql-test/t/user_var.test:
      test case
    sql/item_func.cc:
      At the end of execution top level join execution
      we cleanup this join with true argument.
      It leads to underlying join cleanup(subquery) with true argument too
      and to tmp_table_param->field array cleanup which is required later.
      The problem is that Item_func_set_user_var does not set
      result_filed which leads to unnecessary repeated excution of subquery
      on final stage.
      The fix is to set result_field for Item_func_set_user_var.
    1cffb859
count_distinct.test 3.6 KB