David Johnston <polobo@yahoo.com> writes:
> The whole "varchar/varchar(30)" discrepancy is bothersome and since the
> example forces a function-call via the use of "lower(...)", and doesn't test
> the non-function situation, I am concerned this patch is incorrect.
The reason casting to varchar(30) fails is that that results in invocation
of a function (to enforce the length limit). Casting to varchar is just a
RelabelType operation, which doesn't have two different code paths for
set and not-set inputs.
I did check the patch against your original example, but I thought using
lower() made the purpose of the regression test case more apparent.
regards, tom lane