elein <elein@varlena.com> writes:
> a) if subtypes/domains can have constraints then the model should
> not be different for domains only but for all types. Constraint
> checking would only
> occur at check constraint points--and there for any type. You
> already check for the existance of a domain. Change that test
> to the existence of a constraint only and eliminate domain specific
> code.
Au contraire, the test whether a constraint actually exists occurs at
runtime, not at the time we check for domain-ness. Your proposal would
force such checks to be introduced into every single expression
evaluation. It's not feasible at all without plan invalidation, and
even with that I foresee fairly enormous added overhead. Our experience
with domains so far is that looking up those constraints is *expensive*.
regards, tom lane