On Wed, 2011-10-05 at 15:35 +0200, thomas veymont wrote:
> hello,
>
> let's say that each rows in a table contains a start time and a end
> time ("timeinterval" type),
> but the index are not ordered nor consecutive, e.g :
I think your question has already been answered, but I thought you might
b
2011/10/6 :
>> -Original Message-
>> From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
>> ow...@postgresql.org] On Behalf Of thomas veymont
>> Sent: Wednesday, October 05, 2011 5:35 PM
>> To: pgsql-general@postgresql.org
>> Subject: [GENERAL] gaps/overlaps in a time table : c
> -Original Message-
> From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
> ow...@postgresql.org] On Behalf Of thomas veymont
> Sent: Wednesday, October 05, 2011 5:35 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] gaps/overlaps in a time table : current and previous
I think you need to get the full list of change dates first. Assuming
you're searching over a time period between "period_from" and
"period_to":
SELECT change_time, sum(diff) as total_diff FROM (
SELECT starttime as change_time, 1 AS diff FROM t WHERE starttime >
period_from AND endtime < period_t
2011/10/5 thomas veymont
> hello,
>
> let's say that each rows in a table contains a start time and a end
> time ("timeinterval" type),
>
there is no such type ( no result for select * from pg_type where typname ~
'timeinterval' ).
can you show exact table structure (output of psql "\d" or bette