• unknown's avatar
    Bug#26977 exception handlers never hreturn · 72569cc6
    unknown authored
      - In some cases, flow control optimization implemented in sp::optimize
        removes hreturn instructions, causing SQL exception handlers to:
          * never return
          * execute wrong logic
      - This patch overrides default short cut optimization on hreturn instructions
        to avoid this problem.
    
    
    mysql-test/r/sp-code.result:
      Added test case
    mysql-test/t/sp-code.test:
      Added test case
    sql/sp_head.cc:
      Override opt_mark to get correct execution paths without jump short cut 
      optimization.
    sql/sp_head.h:
      Added override sp_instr_hreturn::opt_shortcut_jump so that jump short cuts aren't
      performed on hreturn instructions operating on handlers which are set to CONTINUE
      after interruption.
    72569cc6
sp-code.test 12.4 KB