Re: Adding ip4r to Postgresql core?

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Chris Travers <chris(dot)travers(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Joe Van Dyk <joe(at)tanga(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Adding ip4r to Postgresql core?
Date: 2013-09-01 18:01:11
Message-ID: 1378058471.21540.26.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2013-08-07 at 23:24 -0700, Chris Travers wrote:

> On Wed, Aug 7, 2013 at 9:44 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> So the obvious question today is whether this isn't
> duplicative of the
> range datatype stuff. IOW, why wouldn't we be better off to
> invent
> inetrange and call it good?

INET allows a mask, and so doesn't offer an obvious total order.
Interestingly, a mask is somewhat like a range, so perhaps we could use
a range type that considers a mask to be an alternate representation of
a range. I thought about that briefly, but it seemed more likely to lead
to confusion or backwards-compatibility problems.

If we just had an IP(v4|v6) type with no mask and a total order, adding
a range type would be trivial.

> actually this misses the one area where ip4r is really helpful and
> that is GiST support. If you want to have an exclusion constraint
> which specifies that no two cidr blocks in a table can contain
> eachother, you can do this easily with ip4r but it takes a lot of work
> without it.

A lot of work (much of it by Alexander Korotkov) has already gone into
improving range type [sp-]gist indexes. And range types go together well
with exclusion constraints. So, I'm not sure I follow how this is a
reason to use ip4r rather than a range type -- can you clarify?

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Janek Sendrowski 2013-09-02 00:23:59 store multiple rows with the SELECT INTO statement
Previous Message Jeff Davis 2013-09-01 17:51:33 Re: Why is NULL = unbounded for rangetypes?