FB3: Stored function accepts duplicate input arguments
------------------------------------------------------

                 Key: CORE-4280
                 URL: http://tracker.firebirdsql.org/browse/CORE-4280
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0 Alpha 1
         Environment: Windows
            Reporter: Robert


(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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to