Adam Mackler <pgsql-general@xxxxxxxxxxx> writes: > One final question: the 'CREATE CAST' command got my interest. I'm > assuming that when the docs say it 'performs a conversion between two > data types,' that the meaning of "data type" includes only those > created using 'CREATE TYPE' and excludes domains. If I am mistaken on > that point I would be grateful to learn of that mistake. I wouldn't recommend it. The expected behavior of up-casting to a domain from its base type is that the value doesn't change but the domain's current check constraints are applied. I think that if you defined a cast via CREATE CAST it would override that behavior (I've not verified this though), and it would then be entirely on your head whether the resulting value was actually a legal member of the domain. regards, tom lane