• Sergey Glukhov's avatar
    Bug#50995 Having clause on subquery result produces incorrect results. · 9245ed4a
    Sergey Glukhov authored
    The problem is that cond->fix_fields(thd, 0) breaks
    condition(cuts off 'having'). The reason of that is
    that NULL valued Item pointer is present in the
    middle of Item list and it breaks the Item processing
    loop.
    
    
    mysql-test/r/having.result:
      test case
    mysql-test/t/having.test:
      test case
    sql/item_cmpfunc.h:
      added ASSERT to make sure that we do not add NULL valued Item pointer
    sql/sql_select.cc:
      skip adding an item to condition if Item pointer is NULL.
      skip adding a list to condition if this list is empty.
    9245ed4a
sql_select.cc 542 KB