• unknown's avatar
    A fix for Bug#32007 select udf_function() doesn't return an error if error · 189ec0e0
    unknown authored
    during udf initialization. The bug is spotted while working on Bug 12713.
    
    If a user-defined function was used in a SELECT statement, and an
    error would occur during UDF initialization, this error would not terminate
    execution of the SELECT, but rather would be converted to a warning.
    
    The fix is to use a stack buffer to store the message from udf_init instead
    of private my_error() buffer.
    
    
    mysql-test/r/udf.result:
      Update the result to reflect the fix for Bug#32007 select udf_function() 
      doesn't return an error if error during udf initialization
    mysql-test/t/udf.test:
      Update the test to reflect the fix for Bug #32007 select udf_function() 
      doesn't return an error if error during udf initialization
    sql/item_func.cc:
      A fix for Bug#32007.
      
      net.last_error buffer was used to store the temporary message from udf_init.
      Then, when my_error() was called, net.last_error was not empty so 
      my_error() would conclude that there is already an error in the error stack, 
      and not "overwrite" it.
      However, thd->net.report_error was not set, so the the 
      SELECT was not aborted.
      
      The fix is to use a stack buffer instead of thd->net.last_error
      to store the message from udf_init. The message will end up in
      thd->net.last_error anyway after a call to my_error.
    189ec0e0
udf.test 10.8 KB