Re: interval origami

Поиск
Список
Период
Сортировка
От Adam Jensen
Тема Re: interval origami
Дата
Msg-id d05565aa-551d-fac3-ba88-8215c8cbe0d4@riseup.net
обсуждение исходный текст
Ответ на Re: interval origami  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: interval origami  (Adam Jensen <hanzer@riseup.net>)
Список pgsql-sql
On 11/30/18 12:57 PM, Alvaro Herrera wrote:
> This sounds like something you can easily do with range types in
> Postgres.  Probably not terribly portable to other DBMSs though.
>   https://www.postgresql.org/docs/11/rangetypes.html


Nice hint. Thanks!

PostgreSQL as the application platform is fine. Portability to other
DBMS's isn't a requirement.

The 'numrange' type with the 'overlaps' and 'intersection' operators
seem to cover the fundamental computations in a very natural way.

hanzer=# SELECT numrange(10, 30) && numrange(12, 32);
 ?column?
----------
 t
(1 row)

hanzer=# SELECT numrange(10, 30) * numrange(12, 32);
 ?column?
----------
 [12,30)
(1 row)

How might they be used in an SQL query to solve the problem? I'm an SQL
noob. Seeing a few examples would be very informative. My impression is
that it might require some serious kung-fu. :)


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: interval origami
Следующее
От: Adam Jensen
Дата:
Сообщение: Re: interval origami