"Rod Taylor" <[EMAIL PROTECTED]> writes: > It would be fairly straight forward to simply copy the domain base > type into the atttypid, then create an atttypdomain (normally 0, > except in the case of a domain). Everything would use the attypid, > except for \d and pg_dump which could use the domain if it exists.
> Is this something I should do? No, because it's quite irrelevant to the problem of type coercion, which works with expressions; attributes are only one part of the expression world. Actually, considering Fernando's point that a CAST ought to apply the constraints associated with a domain type, your attribute-based implementation is wrong anyway. Rather than merging the domain constraints into the table definition (which will be a nightmare for pg_dump to sort out, anyway) keep 'em separate. The constraints could be checked during casting from a base type to a domain type --- take a look at the existing mechanism for enforcing typmod (length limits), which after all is a simplistic kind of domain constraint. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly