pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jon Nelson <jnelson+pgsql@jamponi.net>
Cc: pgsql-bugs@postgresql.org
Subject: Re: inet subtraction fails with IPv6?
Date: Tue, 31 Jan 2012 16:37:11 -0500
Message-ID: <11082.1328045831@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKuK5J3xq5OWR9ToKYZdD4hc=81-jkxzQoW91aom=FaTPEymRA@mail.gmail.com>
References: <CAKuK5J02DxJ+Npq=YCwr4deeNzdOQevpjHF=HA5dboKbeTwJzg@mail.gmail.com>
	<CA+TgmoZbvOwYdL4j1ydT5iWQa0zU=14Y6oXh5n=YP_G6Ze=5cA@mail.gmail.com>
	<CAKuK5J3xq5OWR9ToKYZdD4hc=81-jkxzQoW91aom=FaTPEymRA@mail.gmail.com>

Jon Nelson <jnelson+pgsql@jamponi.net> writes:
> On Tue, Jan 31, 2012 at 2:03 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> What were you expecting to get? There's no such thing as a negative IP address.

> True, but it works for IPv4:

> jnelson=# select inet '255.255.255.255' - inet '0/0';
>   ?column?
> ------------
>  4294967295
> (1 row)

The inet minus inet operator is defined to yield bigint, so it only
copes for addresses within 2^63 of each other.  Short of inventing an
integer type at least 129 bits wide, the only way we could fix this is
to make the operator return numeric instead, which doesn't really seem
like an improvement for typical use-cases.  I'm fairly sure this was
debated when the operator was added, and we thought it was an acceptable
limitation; though maybe with IPv6 finally starting to see real usage
it's going to seem less so.

			regards, tom lane



view thread (4+ messages)

Message-ID: <11082.1328045831@sss.pgh.pa.us>
Permalink:  ../11082.1328045831@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11082.1328045831@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jnelson+pgsql@jamponi.net
  Subject: Re: inet subtraction fails with IPv6?
  In-Reply-To: <11082.1328045831@sss.pgh.pa.us>
  References: <CAKuK5J02DxJ+Npq=YCwr4deeNzdOQevpjHF=HA5dboKbeTwJzg@mail.gmail.com> <CA+TgmoZbvOwYdL4j1ydT5iWQa0zU=14Y6oXh5n=YP_G6Ze=5cA@mail.gmail.com> <CAKuK5J3xq5OWR9ToKYZdD4hc=81-jkxzQoW91aom=FaTPEymRA@mail.gmail.com> <11082.1328045831@sss.pgh.pa.us>

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

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