Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB3: Stored function accepts duplicate input arguments [CORE4280] #4603

Closed
firebird-issue-importer opened this issue Nov 26, 2013 · 4 comments

Comments

@firebird-issue-importer

Submitted by: Robert (rjm1102)

(WI-T3.0.0.30566 Firebird 3.0 Alpha 1)

CREATE FUNCTION seems to accept input arguments with the same name, like:

CREATE FUNCTION Test (X INTEGER, X INTEGER) /* argument X appears twice */
RETURNS INTEGER
AS
BEGIN
RETURN X + 1;
END

I think this should not be allowed, like it is also not allowed for parameters of stored procedures (or any other programming language I know).
I suggest to define a unique key on rdb$function_arguments for (rdb$function_name, rdb$argument_name); note rdb$argument_name is NULL for the return argument, but afaik this is okay for unique keys.

BTW, as far as I could test, no real harm is done by the existence of duplicate arguments; references in the body seem to use the first occurence (so, in the example above, Test(1, 5) will return 2; executing COMMENT ON FUNCTION PARAMETER Test.X IS 'Tests', will assign a comment to both occurences of Test.X in rdb$function_arguments.

- Robert
NL

Commits: 5106986 e4b255f FirebirdSQL/fbt-repository@47d50f3 FirebirdSQL/fbt-repository@84dbc6a

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 26, 2013

Commented by: @asfernandes

A solution with unique index, like is done for procedures, is not easy on this situation.

Parameters of legacy UDFs may be unnamed.

If we could write a system expression index, it would be solvable, but we neither can do it currently.

So I believe a programatic approach would be necessary here.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Nov 9, 2014

Modified by: @dyemanov

Regression: 3.0 Alpha 1 [ 10331 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 17, 2014

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 29, 2015

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants