Lua pcall function returns unexpected data in error case

Details

Detail name Value
Changelog Number 1148
Type Bug
Status Open
Affected Versions EXASOL 6.0.0, EXASolution 5.0.0, Exasol 6.1.0, Exasol 6.2.0, Exasol 7.0.0, Exasol 7.1.0, Exasol 8.0.0, Exasol 8.29.0, Exasol 2025.1.0, Exasol 2025.2.0

The pcall function calls its first argument in protected mode, so that it catches any errors while the function is running. If there are no errors, pcall returns true, plus any values returned by the call. Otherwise, it returns false, plus the error message. Error message does not have to be a string. It can be any value passed to error function.

create or replace lua script error_test ()
as

        function throw ()
                error( { 10, 20 } )
        end

        status, err = pcall(throw)

        output(type(status)) -- > is 'boolean', this is correct
        output(type(err))    -- > is 'string', this is not correct, it should be 'table'

/

execute script error_test with output;