The method name “leastRestrictiveByCast" does make it look that way. I do not 
recall why the method has that name. However, “leastRestrictive" is used in 
places where casts are not involved, and coercion should not occur.

For instance, if I change those two ‘false’ values to ‘true’, Optiq’s validator 
allows

  values (1), (’a’)

and

  select * from emp where deptno in (1, ‘a’)

as valid whereas it should give an error.

Can you give a use case where the current behavior is wrong?

Julian

On Sep 16, 2014, at 3:14 PM, Ashutosh Chauhan <[email protected]> wrote:

> SqlTypeFactoryImpl::leastRestrictive() calls leastRestrictiveByCast() which
> calls sqlTypeUtil.canCastFrom(type, resultType, false). Last boolean
> argument is about type coercion. Since, its called from SqlTypeFactoryImpl,
> I expected coercion should have been allowed here and canCastFrom() should
> have been called with true, atleast thats what comment of canCastFrom()
> method seems to suggest. Is this a bug or am I missing something here?
> 
> Thanks,
> Ashutosh

Reply via email to