Page 1 of 1

spurious error on selector invocation for a UDT value

Posted: Fri Dec 02, 2011 9:41 am
by HughDarwen
The following type definition was accepted by Rel 1.07 beta:

type time possrep { c char constraint LENGTH(c) = 5 AND IS_DIGITS(SUBSTRING(c,0,2)) AND IS_DIGITS(SUBSTRING(c,3,2)) AND SUBSTRING(c,2,1) = ':'};

However, time('17:52') results in

ERROR: Failure executing external function: java.lang.reflect.InvocationTargetException

Line 1, column 6 near '"17:32"'


Hugh Darwen

Re: spurious error on selector invocation for a UDT value

Posted: Fri Dec 02, 2011 10:15 am
by HughDarwen
Since I reported this "bug" a few minutes ago I discovered that SUBSTRING(CHAR, INTEGER, INTEGER) takes an end position rather than a length as the third operand. So this is in fact a user error and not a bug. However, can I change this into a suggestion for a more explanatory error message. I can understand why this might be too tricky, though.

Hugh

Re: spurious error on selector invocation for a UDT value

Posted: Fri Dec 02, 2011 2:23 pm
by Dave
I'll see what I can do to provide a more meaningful error message when Java-based user-defined operators fail internally.

At the very least, I'll change the provided SUBSTRING definition so that it can't fail in this manner.