I'm trying to create a seconds domain that is an interval 'mashed to
seconds' as I once saw Tom describe it.
decibel=# create domain rrs.seconds as double precision;
CREATE DOMAIN
decibel=# create cast (double precision as rrs.seconds) WITHOUT FUNCTION AS IMPLICIT;
CREATE CAST
decibel=# create function rrs.interval_to_seconds(interval) returns seconds as 'SELECT extract( EPOCH FROM $1 );'
LANGUAGESQL;
CREATE FUNCTION
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
\dC shows that the cast is there, and rrs.interval_to_seconds works as
expected, and according to \df does return seconds.
Version is 7.4.5.
--
Jim C. Nasby, Database Consultant decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"