Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> I wonder if we actually did the right thing with this.
> ...
> Wouldn't that mean the operation is supposed to succeed with
> diagnostic information since it's a completion condition not
> an exception condition?
Hm. You are right: an explicit cast to varchar(n) has different
behavior according to the spec than a store assignment (ie,
implicit coercion) to varchar. The implicit coercion should fail.
AFAIR our cast mechanisms aren't prepared to use two different
routines for these two cases. Looks like we have some work to do.
regards, tom lane