On Wed, 13 Jun 2007, Nathan.Keynes@csiro.au wrote:
> In org.postgresql.core.v3.SimpleParameterList there is the following
> code:
>
> void setResolvedType(int index, int oid) {
> // only allow overwriting an unknown value
> if (paramTypes[index-1] == Oid.UNSPECIFIED) {
> paramTypes[index-1] = oid;
> } else if (paramTypes[index-1] != oid) {
> throw new IllegalArgumentException("Can't change resolved
> type for param: " + index + " from " + paramTypes[index] + " to " +
> oid);
> }
> }
>
> In the throw statement, paramTypes[index] should be paramTypes[index-1].
> (This was a little confusing until we spotted it).
Fix applied to CVS for 8.0, 8.1, 8.2, and 8.3dev.
> It's possible the message could be more explanatory as well, would
> something like "Param " + index + " type mismatch - expected " +
> getNameForOid(oid) + " but was bound to " +
> getNameForOid(paramTypes[index-1]) make sense?
>
Getting the names for the oids is tough from this part of the code so I
don't think we can do that. Also I think this is supposed to be a "can't
happen" error that's more of an assert than a message for an end user.
Do you have an example of how to trigger this condition?
Kris Jurka