Tom Lane wrote:
> Peter Nixon <listuser@peternixon.net> writes:
>> I am trying to cast a INTERVAL to an INT (or BIGINT) without much
>> success.
>
> "extract(epoch from <interval>)" will produce the interval's value in
> seconds ... as a float8, but you can cast that to bigint ...
Thanks
The following seems to do what I need.
AcctSessionTime = (EXTRACT(EPOCH FROM(now()::timestamp with time zone -
AcctStartTime::timestamp with time zone -
'%{Acct-Delay-Time:-0}'::interval)))::BIGINT
If not, I am sure some users will start screaming shortly :-)
--
Peter Nixon
http://www.peternixon.net/
PGP Key: http://www.peternixon.net/public.asc