"Jim C. Nasby" <decibel@xxxxxxxxxxx> writes: > decibel=# create cast (interval as rrs.seconds) WITH FUNCTION rrs.interval_to_seconds(interval) AS IMPLICIT; > CREATE CAST > decibel=# select cast('1 month'::interval AS seconds); > ERROR: cannot cast type interval to seconds Given the current coercion rules, we should probably disallow attempts to define casts that involve domains. Casts are on base types. The down-cast from a domain to its base type is hardwired, and the up-cast from base type to domain is too (with invocation of any constraints that may apply). Adding random user-defined casts to this would probably just create confusion and ambiguity. In particular, this was already meaningless: decibel=# create domain rrs.seconds as double precision; CREATE DOMAIN decibel=# create cast (double precision as rrs.seconds) WITHOUT FUNCTION AS IMPLICIT; CREATE CAST since the presence of the cast might be thought to justify coercing floats to "seconds" without invoking domain constraints. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq