Bug #45125 Incorrect number of arguments for FUNCTION
Submitted: 27 May 2009 10:16 Modified: 27 Jun 2009 13:41
Reporter: orlok nosf Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.34 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: arguments, FUNCTION

[27 May 2009 10:16] orlok nosf
Description:
When calling a function through the Connector/Net (and maybe other connectors) I receive errors like "Incorrect number of arguments for FUNCTION myschema.myfunction; expected N, got n", though the calling code is correct with the correct number of arguments passed.

The main reason of this problem is related to the way the function is declared in the server. When the type of an argument is followed by parenthesis, for example INT (11), there should be no space between the type and the opening parenthesis.

How to repeat:
Declare a function beginning like this:

CREATE FUNCTION `myfunction`(foo BIGINT, bar INT (11)) RETURNS BIGINT ...

Note that there is a space between the type INT and the opening parenthesis.

If you call this function using Connector/Net, you will receive the error message "Incorrect number of arguments for FUNCTION myschema.myfunction; expected 2, got 1"

However there is no error if you call the function from the command line tool 'mysql' or from the query browser.

Suggested fix:
Don't know which part should be fixed...

A workaround is to remove the space.
[27 May 2009 13:41] Tonci Grgin
Hi and thanks for your report.

I think this is a duplicate of Bug#41034 and has nothing to do with server. Can you please test c/NET 5.2.6 or 5.2.7 and see if error persists?
[27 Jun 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".