You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Jack Klebanoff (JIRA)" <de...@db.apache.org> on 2005/03/26 02:44:16 UTC

[jira] Created: (DERBY-183) Parameter names required in CREATE FUNCTION

Parameter names required in CREATE FUNCTION
-------------------------------------------

         Key: DERBY-183
         URL: http://issues.apache.org/jira/browse/DERBY-183
     Project: Derby
        Type: Bug
    Versions: 10.0.2.0    
    Reporter: Jack Klebanoff
    Priority: Minor


A statement like
  create function s2.f2( char(8), integer) returns int
  language java parameter style java  external name 'myclass.mymethod'
fails with the message
  ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
However
  create function s2.f2( p1 char(8), p2 integer) returns int
  language java parameter style java  external name 'myclass.mymethod'
is accepted.
The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams updated DERBY-183:
---------------------------------

    Attachment: Derby183.patch4.txt

The lookahead in the grammar of my previous patches did not work for some parameter types.  I have reworked the lookahead to use syntactic lookahead similar to that used elsewhere in the grammar.  I have included an additional test that would have failed with the previous patch.  I have run the lang/functions.sql and lang/procedure.java using the various frameworks without error.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt, Derby183.patch4.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12442083 ] 
            
Bryan Pendleton commented on DERBY-183:
---------------------------------------

Thanks James! This patch resolved my derbyall issues; my run was 100% clean.

The patch looks good to me; I intend to commit it. If anybody else is
reviewing it, please let us know.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Mike Matrigali (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

Mike Matrigali updated DERBY-183:
---------------------------------


Are you planning on submitting tests for this, I didn't see any in the patch?

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams updated DERBY-183:
---------------------------------

    Attachment: Derby183.patch2.txt

I have attached an updated patch (Derby183.patch2.txt) that modifies the following files:

java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedure.java
java/testing/org/apache/derbyTesting/functionTests/master/procedure.out
java/testing/org/apache/derbyTesting/functionTests/util/ProcedureTest.java

java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql
java/testing/org/apache/derbyTesting/functionTests/master/functions.out

Tests have been added to lang/functions.sql and lang/procedure.java.
I added a comment to sqlgrammar.jj to explain the need for the LOOKAHEAD(2).

The parameter name is made optional by surrounding its production with [].

This changes the grammar from:

	parameterName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
 	typeDescriptor = dataTypeDDL() 

to:

        [ parameterName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true) ]
        typeDescriptor = dataTypeDDL() 

This results in a choice conflict because certain tokens satisfy both identifier() and dataTypeDDL().  An additional token of lookahead resolves this conflict.  This results in:

        [ LOOKAHEAD(2) parameterName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true) ]
        typeDescriptor = dataTypeDDL() 

Expressing this in an alternate form such as:

        ( 
                parameterName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
                typeDescriptor = dataTypeDDL() 
        ) | typeDescriptor = dataTypeDDL() 

still results in a choice conflict so I opted for the more compact form.



> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12441837 ] 
            
James F. Adams commented on DERBY-183:
--------------------------------------

I have a patch ready that should resolve the remaining test issues.  I currently can not upload an attachments.  Issue INFRA-984 has been filed by Yip Ng.  As soon as this is resolved I will attach the new patch.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12440771 ] 
            
Bryan Pendleton commented on DERBY-183:
---------------------------------------

Hello James, thanks for looking at this problem, and thanks for the patch!

It would be nice if the patch included some test cases, both to syntactically
demonstrate the handling of various combinations of named and unnamed parameters,
and to demonstrate the correct execution of such functions.

Also, could you expand upon the meaning of  "LOOKAHEAD(2)" in the parser change?
I'm not that familiar with the way that LOOKAHEAD functions, so was confused as to
why it was added here. Perhaps you could add some comments in the code itself to
explain the usage of LOOKAHEAD(2). I assume that it effectively makes the parameter
name be optional; how does that technique compare to, say, having two alternate
productions in functionParameterDefinition(), one with a parameter name and one without?



> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams updated DERBY-183:
---------------------------------

    Derby Info: [Patch Available]

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

Satheesh Bandaram updated DERBY-183:
------------------------------------

    Component: SQL

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>          Key: DERBY-183
>          URL: http://issues.apache.org/jira/browse/DERBY-183
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: Jack Klebanoff
>     Priority: Minor

>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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


[jira] Resolved: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

Bryan Pendleton resolved DERBY-183.
-----------------------------------

    Fix Version/s: 10.3.0.0
       Resolution: Fixed
       Derby Info:   (was: [Patch Available])

Committed Derby183.patch3.txt, plus a comment-only change to RoutineAliasInfo.java,
to subversion as revision 463982.

James, thanks for the patch and for the tests and for the good comments. Could you
please verify that the changes look correct to you, and then close this issue? Thanks!


> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Resolved: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

Bryan Pendleton resolved DERBY-183.
-----------------------------------

    Resolution: Fixed

Thanks for doing the additional testing, James, and for the updated patch.

I verified that the new test cases fail without your change to the grammar,
and succeed with your change to the grammar. My derbyall run was 100% clean,
so I committed Derby183-patch4.txt to subversion as revision 464078.


> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt, Derby183.patch4.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12441215 ] 
            
Bryan Pendleton commented on DERBY-183:
---------------------------------------

Hi James, thanks for the updated patch, and for the clear explanation of the LOOKAHEAD behaviors.

The tests look good to me. They demonstrate the problem: they fail without the code changes, and
they succeed when the code changes are applied. It is always good to have tests such as these.

I had no trouble applying your patch and running the two modified tests.

+1 from me to commit; is anyone else reviewing this change?

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams updated DERBY-183:
---------------------------------

    Attachment: Derby183.patch3.txt

Thanks Bryan for reviewing my patches.

Attached is a new patch that modifies the following files and resolves the testing issues:

java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedure.java
java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/jdk16/procedure.out
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/procedure.out
java/testing/org/apache/derbyTesting/functionTests/master/functions.out
java/testing/org/apache/derbyTesting/functionTests/master/procedure.out
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/procedure.out
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/procedure.out
java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/procedure.out
java/testing/org/apache/derbyTesting/functionTests/util/ProcedureTest.java

I ran the lang/procedure.java and lang/functions.sql  tests using the embedded, DerbyNet,
and DerbyNetClient frameworks with Java versions 1.3, 1.4, 1.5, and 1.6 and saw no errors.


> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Updated: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams updated DERBY-183:
---------------------------------

    Attachment: Derby183.patch.txt

I have attached a patch that:

1) Modifies java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    a) Initializes parameterName to "" in procedureParameterDefinition and functionParameterDefinition
    b) Makes parameterName optional in procedureParameterDefinition and functionParameterDefinition

2) Modifies java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java to ignore function and procedure parameter names equal to "" when checking for duplicate parameter names.

I have run derbyall with no additional failures noted.  I also ran dblook on a database which contained functions and procedures with parameters that had just parameter types specified.  The resultant DML looked good.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12441319 ] 
            
Bryan Pendleton commented on DERBY-183:
---------------------------------------

When I ran derbyall, lang/procedure.java failed in the DerbyNet and DerbyNetClient frameworks.
There are multiple procedure.out files in the various frameworks. Unfortunately,
I think that all of them have to be updated. The diff should be the same in all of them,
since your test doesn't depend on any particular network or JVM features.

To see the problem:
java -Dframework=DerbyNetClient org.apache.derbyTesting.functionTests.harness.RunTest lang/procedure.java

To see all the procedure.out files that need to be updated, do:
find trunk/java -name procedure.out


> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Reopened: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams reopened DERBY-183:
----------------------------------

             
I found through some additional testing that the previous patch has a problem for some parameter types.   I have a re-worked  patch that I will attach that resolves this.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Bryan Pendleton (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12442313 ] 
            
Bryan Pendleton commented on DERBY-183:
---------------------------------------

I believe that RoutineAliasInfo.getParameterNames()[n] will return the empty string.

It's a bit hard to figure this out directly, because I couldn't figure out how that method
would get called from, say, an SQL statement.

However, I looked at this indirectly by running dblook against a database which had
some functions with unnamed parameters, and the output of dblook was as follows:

CREATE FUNCTION "APP"."NONAME1" ( INTEGER, INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

CREATE FUNCTION "APP"."NONAME2" (P1 INTEGER, INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

By examining how RoutineAliasInfo.toString works, it seems that if the parameterNames
array held NULL for the unnamed parameters, then dblook would have generated:

CREATE FUNCTION "APP"."NONAME1" (NULL INTEGER,NULL INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

CREATE FUNCTION "APP"."NONAME2" (P1 INTEGER,NULL INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

So therefore I think that the parameterNames array contains empty strings, not null values,
for unnamed parameters.

I'll add a comment to this effect in the RoutineAliasInfo class.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12440773 ] 
            
James F. Adams commented on DERBY-183:
--------------------------------------

I will create some test cases as suggested and add an explanation why the additional lookahead is needed in the grammar.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12442087 ] 
            
Daniel John Debrunner commented on DERBY-183:
---------------------------------------------

If a routine's parameter is created without a parameter name, then what will this expression return for the RoutineAliasInfo describing the routine?

RoutineAliasInfo.getParameterNames()[n]

Is it null for no name specified or the empty string?

Would be good to document this in the RoutineAliasInfo class.



> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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

        

[jira] Assigned: (DERBY-183) Parameter names required in CREATE FUNCTION

Posted by "James F. Adams (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-183?page=all ]

James F. Adams reassigned DERBY-183:
------------------------------------

    Assignee: James F. Adams

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement), the SQL2003 standard, and DB2 all agree that the parameter name is optional.

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