agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Adam Jensen <hanzer@riseup.net>
To: pgsql-sql@lists.postgresql.org
Subject: Re: interval origami
Date: Sat, 1 Dec 2018 08:24:25 -0500
Message-ID: <eed7d93d-2db6-c5af-8623-fa5f492b2e4d@joeconway.com> (raw)
In-Reply-To: <6d32b24f-2d3e-df79-81d2-3b1abb8cc4b4@riseup.net>
References: <20181130175719.l7izv65wjwgkls35@alvherre.pgsql>
	<d05565aa-551d-fac3-ba88-8215c8cbe0d4@riseup.net>
	<6d32b24f-2d3e-df79-81d2-3b1abb8cc4b4@riseup.net>

On 11/30/18 4:02 PM, Adam Jensen wrote:
> On 11/30/18 3:19 PM, Adam Jensen wrote:
>> The 'numrange' type with the 'overlaps' and 'intersection' operators
>> seem to cover the fundamental computations in a very natural way.
> 
> Actually, those operators might not be entirely sufficient. Given two
> ranges like this:
> 
> 10.0|39.0|interesting
> 15.0|21.0|fail
> 
> Something like the negative or inverse of the intersection is needed:
> 
> 10.0|15.0|interesting
> 21.0|39.0|interesting

Perhaps overkill, but if you represent your timeline as actual line
segments, perhaps PostGIS would be useful. E.g.:

https://postgis.net/docs/manual-2.5/ST_Difference.html

HTH,

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development




view thread (10+ messages)  latest in thread

Message-ID: <eed7d93d-2db6-c5af-8623-fa5f492b2e4d@joeconway.com>
Permalink:  ../eed7d93d-2db6-c5af-8623-fa5f492b2e4d@joeconway.com/
Also on:    postgresql.org/message-id/eed7d93d-2db6-c5af-8623-fa5f492b2e4d@joeconway.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail@joeconway.com, hanzer@riseup.net, pgsql-sql@lists.postgresql.org
  Subject: Re: interval origami
  In-Reply-To: <eed7d93d-2db6-c5af-8623-fa5f492b2e4d@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox