Thomas,

On Wed, Aug 22, 2012 at 12:25 PM, Thomas Munro <mu...@ip9.org> wrote:
> I noticed that 'avg' works on 'interval', but 'stddev' and 'variance' don't:

I don't know why, but you could convert 'interval' into something else
where all the functions work:

CREATE OR REPLACE FUNCTION interval_to_seconds(interval)
RETURNS double precision AS $$
    SELECT (extract(days from $1) * 86400)
         + (extract(hours from $1) * 3600)
         + (extract(minutes from $1) * 60)
         + extract(seconds from $1);
$$ LANGUAGE SQL;

Cheers,

Chris
-- 
Christopher Swingley
Fairbanks, Alaska
http://swingleydev.com/
cswin...@gmail.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to