Intersection of two time segments

Поиск
Список
Период
Сортировка
От Jon Burroughs
Тема Intersection of two time segments
Дата
Msg-id 4346A75E.7040808@noaa.gov
обсуждение исходный текст
Ответы Re: Intersection of two time segments  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-novice
I'm doing some temporal queries in PostgreSQL and am in need of a way to
find the start/end times for overlapping time segments.

I know about this query, which will tell me whether or not a time
segment overlaps:
select (timestamp '2001-02-01 0:00', timestamp '2001-09-30 0:00')
overlaps (timestamp '2001-01-01 0:00', timestamp '2001-04-30 0:00');

But I would like to know the actual start/end times for the overlapping
segment (i.e. 2002-02-01 to 2001-04-30).  Is there something already
available that will do that, or do I have to write a function to do this?

Thanks!

-Jon

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Sequences, triggers and 'OLD' - am I being stupid?
Следующее
От:
Дата:
Сообщение: Set Privileges on All Tables (and/or Sequences) at Once