Bug #54840 Error: unknow error during fetching,
Submitted: 27 Jun 2010 15:28 Modified: 29 Jul 2010 16:51
Reporter: lid bit Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:5.2.24 OS:Any (Windows, Mac OS X)
Assigned to: Lawrenty Novitsky CPU Architecture:Any

[27 Jun 2010 15:28] lid bit
Description:
calling a Function, create by CREATE FUNCTION, return an undefined error when calling with no parameters in MySQL workbench 5.2

actual message returned: 

"Error: Unknown error during fetching"

when expected

ERROR 1318 (42000): Incorrect number of arguments for FUNCTION

to be shown

How to repeat:
-- function definition 
delimiter //

CREATE Function _getActivePost(_author INT)

RETURNS INT
DETERMINISTIC

BEGIN

    RETURN 55;

END

//

-- How to call
Select _getActivePost();
[27 Jun 2010 18:09] Valeriy Kravchuk
Thank you for the bug report. Verified just as described with 5.2.24 on Mac OS X.
[28 Jun 2010 5:13] lid bit
another case where unknown error reported

desired error output :
"ERROR 1336 (0A000): Dynamic SQL is not allowed in stored function or trigger"

To reproduce this result I used a stored function  that invokes  a Stored Procedure which uses a PREPARE statement

I assume that both bug are related in a sense, and we actually talking on the same issue, even though this is a different error

To reproduce:
-----------------------------------------------
DROP function IF EXISTS  aaa;
DROP procedure IF EXISTS bbb;
delimiter //

CREATE FUNCTION aaa(_p INT)
    RETURNS INT
    READS SQL DATA 
BEGIN
    call bbb(888);
    return @a;
    
END;//

CREATE  procedure bbb (inout _p INT )
    READS SQL DATA 
    BEGIN
            set @_p := _p;
            PREPARE  s1 from "select  1,2,3,?";
            EXECUTE s1 using @_p;
END
//
delimiter ;

select aaa(0);
[21 Jul 2010 14:42] Sergei Tkachenko
After running "select _getActivePost()" Connector/C++ doesn't throw exception, while it should, neither it returns results by calling to Statement::getResultSet().
[28 Jul 2010 21:40] Lawrenty Novitsky
Fix and a testcase have been pushed as rev#887
Andrey, please review it - suspect you could not forward the exception in getResultSet for a reason. However I don't see why we shouldn't forward it to a user. I will post here the diff too.
[28 Jul 2010 21:40] Lawrenty Novitsky
fix+testcase

Attachment: bug54840.diff (application/octet-stream, text), 1.91 KiB.

[29 Jul 2010 16:51] Lawrenty Novitsky
Correction of the patch discussed with andrey has been pushed to the trunk as rev#888. Ticking review box on his behalf and closing bug.