• unknown's avatar
    A fix and a test case for Bug#9520 "SELECT DISTINCT crashes server · 963e94ce
    unknown authored
    with cursor". The patch refactors do_select/sub_select
    functions, which implement the nested loop algorithm, and reuses them to
    fetch rows for cursors as well.
    Pushing with view.test failing (--ps-protocol).
    
    
    sql/sql_prepare.cc:
       Cursor::fetch() now returns void
    sql/sql_select.cc:
      A fix for Bug#9520 "SELECT DISTINCT crashes server with cursor":
      * rename sub_select returns codes to be able to track down what's going
        on in which case.
      * move record processing and outer join record processing to a separate
        function, out of sub_select read-record loop.
      * use generalized sub_select() nested loop function for
      cursors instead of own loop implementation used in Cursor::fetch() before
    sql/sql_select.h:
      Replace all return values of sub_select family with enum.
      Add JOIN::resume_nested_loop flag to indicate we are restarting the nested loop
      for execution of next chunk of cursor's rows.
    tests/mysql_client_test.c:
      A test case for Bug#9520 "SELECT DISTINCT crashes server with cursor"
    963e94ce
sql_prepare.cc 65.3 KB