db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Lichtman <swa...@rcn.com>
Subject Re: [PATCH] (DERBY-582) Dynamic parameter should be allowed to be the operand of unary operator "-". Derby throws exception 42X36: The '-' operator is not allowed to take a ? parameter as an operand."
Date Sun, 02 Oct 2005 08:04:16 GMT
I've been thinking about where "- ?" should be allowed in queries. 
Currently, parameters are allowed only in certain situations - the 
documentation lists seventeen different places where parameters can 
be used. These places were chosen because it's possible to figure out 
the type of the parameter from the context. For example, a parameter 
can be used as the first operand of BETWEEN as long as the one of the 
second and third operands is not a parameter.

It seems to me that a parameter could be used with a unary minus 
anywhere a "bare" parameter is allowed. Derby could use the same 
rules to determine the type of the parameter as if the minus weren't 
there. Obviously, there would have to be an error if the type isn't numeric.

I don't think we should allow unary minus on parameters in any other 
cases. This seems obvious, but it means poring over the code and 
looking for all the places where parameters are excluded, and making 
it look for parameters under a unary minus.

                        -        Jeff Lichtman
                                 Check out Swazoo Koolak's Web Jukebox at

View raw message