Re: [GENERAL] gaps/overlaps in a time table : current and previous row question

2011-10-19 Thread Jeff Davis
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

Re: [GENERAL] gaps/overlaps in a time table : current and previous row question

2011-10-06 Thread thomas veymont
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

Re: [GENERAL] gaps/overlaps in a time table : current and previous row question

2011-10-06 Thread depstein
> -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

Re: [GENERAL] gaps/overlaps in a time table : current and previous row question

2011-10-05 Thread Phil Couling
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

Re: [GENERAL] gaps/overlaps in a time table : current and previous row question

2011-10-05 Thread Filip RembiaƂkowski
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