From: Mr Dash Four <mr.dash.four@googlemail.com>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #7575: "between" does not work properly with inet/cidr addresses
Date: Sun, 30 Sep 2012 13:14:52 +0100
Message-ID: <506837BC.3050305@googlemail.com> (raw)
In-Reply-To: <15990.1348982762@sss.pgh.pa.us>
References: <E1THijW-00022e-9T@wrigleys.postgresql.org>
<15990.1348982762@sss.pgh.pa.us>
> 10.1.1.0/24 is different from, and sorts before, 10.1.1.0/32
> (which is what '10.1.1.0'::inet is an abbreviation for).
>
> You might find that the net address inclusion operators (<< and friends)
> provide the semantics you're looking for.
That isn't possible in my case, because on the right side I have IP
ranges (from-to) and currently there isn't a PostgreSQL function which
converts IP ranges to cidr/inet, but even if there was such function
available, this may produce more than one cidr/inet ranges, so it won't
be of much use. Employing << and friends is of no use either, as they
work on inet/cidr on the right side - I can't use something like
"10.1.1.0/24 << (10.1.1.0-10.1.1.255)" for example.
> BETWEEN only knows about
> btree sort ordering, which is fundamentally a brick or two shy of a
> load when considering two-dimensional quantities such as netmasks.
>
If BETWEEN can't handle operations between cidr/inet and IP ranges
(which is what I highlighted in the initial bug report), it should
either be fixed to produce the correct result or it should return an
error. Leaving things as they are can't be allowed.
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: mr.dash.four@googlemail.com
Subject: Re: BUG #7575: "between" does not work properly with inet/cidr addresses
In-Reply-To: <506837BC.3050305@googlemail.com>
References: <E1THijW-00022e-9T@wrigleys.postgresql.org> <15990.1348982762@sss.pgh.pa.us> <506837BC.3050305@googlemail.com>
* 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