"Command Prompt, Inc." <pgsql-general@commandprompt.com> writes:
> Look into SQL92 extract() syntax, or PostgreSQL's date_part(). It's sort
> of a hack, but you could extract the days and multiply by 24, and then add
> the hours field, e.g.:
> Depending on how large your intervals got, you might have to start
> extracting week, month or year fields as well. Does anyone know a better,
> more general solution than this? Something like extract(CUMULATIVE_HOURS),
> or something? ;)
date_part('EPOCH', foo) gives the total number of seconds in an
interval. Or you can write extract(epoch from foo) if you want
to pretend this is SQL92-compatible. Unfortunately it didn't
occur to the SQL authors to provide such a function...
regards, tom lane