db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3069) Derby does not resolve functions bound to methods with varargs.
Date Wed, 12 Sep 2007 16:54:32 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526851
] 

Rick Hillegas commented on DERBY-3069:
--------------------------------------

Thanks for helping me puzzle through these issues.

Just to be clear, I don't want to tackle varargs in CREATE FUNCTION statements. I think that
lies outside the SQL standard. However, I think that the Derby SQL interpreter should be able
to resolve method calls which the Java compiler can handle. So, for example, given the following
method declaration in a Java class

    public  static  String  varArgsFunc( String... args )

I think that the following bindings should be meaningful and should be resolved when the functions
are actually invoked:

create function twoArgs( arg1 varchar( 10 ), arg2 varchar( 10 ) )
returns varchar( 40 )
language java
parameter style java
no sql
external name 'z.varArgsFunc'
;

create function threeArgs( arg1 varchar( 10 ), arg2 varchar( 10 ), arg3 varchar( 10 ) )
returns varchar( 40 )
language java
parameter style java
no sql
external name 'z.varArgsFunc'
;

Part 13 of the SQL standard is a little vague, but the resolution rules in the last paragraph
of section 4.2.2 lead me to believe that the intention is that the SQL interpreter should
follow the method resolution rules used by Java itself. I may not know where to look, but
it seems to me that the Standard is vague about which version of Java is intended.

I have no problem classifying this as an improvement rather than a bug. However, I think that
for customers who are using Java 5 or Java 6, the description of CREATE FUNCTION in the Reference
Guide is vague and misleading enough that something ought to be done: either tighten up the
documentation or implement varargs resolution. I think that the latter makes Derby more useful.

> Derby does not resolve functions bound to methods with varargs.
> ---------------------------------------------------------------
>
>                 Key: DERBY-3069
>                 URL: https://issues.apache.org/jira/browse/DERBY-3069
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0,
10.3.1.4
>            Reporter: Rick Hillegas
>         Attachments: z.java, z.sql
>
>
> Varargs were added in Java 5. It would be nice if Derby let you invoke a function bound
to a method with a variable length argument list. The Reference Guide states a small number
of restrictions for methods which can be invoked as Derby functions: They must be public,
static, and not have arguments which are long datatypes. I see no reason that Derby shouldn't
be able to resolve and invoke functions which are bound to methods which don't suffer these
limitations but which have variable argument lists.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message