I wrote:
> It occurs to me that a cleaner solution would be to stop giving domain
> types the same typinput routines as their base types. Instead, give
> them all a specialized routine domain_in (comparable to array_in) that
> first invokes the base type's input function and then applies any
> relevant constraint checks.
I did most of the work of coding this up, only to watch the idea
crash and burn: datatype input routines aren't called at all for
NULL values, so there's no way to enforce a NOT NULL domain constraint
from the input routine.
Currently trying to think of decent alternatives ...
regards, tom lane