You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: