Jaime Casanova <jaime(at)2ndquadrant(dot)com> writes:
> If i create a DOMAIN an then want to create a CAST from that domain to
> another type it gives an error.
Yes. See previous discussions about that, e.g. these threads:
http://archives.postgresql.org/pgsql-hackers/2006-05/msg00072.php
http://archives.postgresql.org/pgsql-hackers/2006-09/msg00695.php
It's *not* trivial to fix, at least not in a way that gives desirable
behavior for more than the simplest cases.
regards, tom lane