Skip site navigation (1) Skip section navigation (2)

Re: [BUGS] Bug in create operator and/or initdb

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] Bug in create operator and/or initdb
Date: 2005-01-31 15:23:05
Message-ID: (view raw or flat)
Lists: pgsql-bugspgsql-hackers
On Sun, Jan 30, 2005 at 09:49:43PM -0600, Larry Rosenman wrote:
> On Sun, 30 Jan 2005, Tom Lane wrote:
> >Steve Atkins <steve(at)blighty(dot)com> writes:
> >>For a replacement type, how important is it that it be completely
> >>compatible with the existing inet/cidr types? Is anyone actually using
> >>inet types with a non-cidr mask?
> >
> >If you check the archives you'll discover that our current inet/cidr
> >types were largely designed and implemented by Paul Vixie (yes, that
> >Vixie).  I'm disinclined to second-guess Paul about the external
> >definition of these types; I just want to rationalize the internal
> >representation a bit.  In particular we've got some issues about
> >conversions between the two types ...
> Please do **NOT** break the external representations.  We had enough fights
> about that 2-3 releases ago, and I personally don't want to revisit them.

> Yes, we do flakey things with inet on the masking stuff.

Well, if you want the ability to store both a host address and a
netmask in the same datatype the inet masking stuff makes sense.
That's not really a useful datatype for any actual use, but it's
fairly well-defined. The problem is that when someone looks at the
docs they'll see inet as the obvious datatype to use to store IP
addresses, and it isn't very good for that.

But that's not all that's flakey, unfortunately.

The CIDR input format is documented to be classful, which in itself is
horribly obsolete and completely useless in this decades internet (and
was when the current code was written in '98).

But the implementation isn't either classful or classless, and the
behaviour disagrees with documented behaviour, and the behaviour you'd
reasonably expect, in many cases.

-- Class A - documented to be
  steve=# select ''::cidr;

-- Class B - documented to be
  steve=# select ''::cidr;

-- Class C - documented to be
  steve=# select ''::cidr;

-- Class D
  steve=# select ''::cidr;
  ERROR:  invalid cidr value: ""
  DETAIL:  Value has bits set to right of mask.

  steve=# select ''::cidr;

-- Class E
  steve=# select ''::cidr;

I use postgresql for network-related applications and for IP address
related data mining, so I'm dealing with IP addresses in postgresql
on a daily basis.

The cidr type, including it's external interface, is simply broken.
There is no way to fix it that doesn't change that external interface.

I know of at least two independant implementations of function IP
address types that have been put together for specific projects to
implement a working IP datatype. The ability to use gist indexes on
them to accelerate range-based lookups is a bonus.

If it's not possible (for backwards compatibility reasons) to fix
inet+cidr, would migrating them out to contrib be a possibility?
Data types in the core tend to be widely used, even if they're
broken and there are better datatypes implemented as external


In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2005-01-31 16:20:31
Subject: Re: Group-count estimation statistics
Previous:From: Alvaro HerreraDate: 2005-01-31 15:01:19
Subject: Re: Two-phase commit for 8.1

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-01-31 16:21:31
Subject: Re: BUG #1440: ecpg seg faults
Previous:From: Rolf SponselDate: 2005-01-31 14:07:53
Subject: [Feed-back] Installing PostgreSQL 8.0.0 on SPARC/Solaris. Configure and install issues

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group