Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> writes:
> so ISTM that your example is certainly a deficiency if not a bug.
I believe it is a bug or at least an unimplemented feature in plpgsql:
plpgsql has its own implementation of casting, and is not aware that
casting to a domain should involve running check constraints.
The same might be true of the other PL languages, not sure.
regards, tom lane