Re: Problem with CIDR data type restrictions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with CIDR data type restrictions
Date: 2004-10-08 16:37:03
Message-ID: 13609.1097253423@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Not sure how we can fix this without modifying the system tables.

We can't: the only possible fix is to make inet-to-cidr not be a binary
compatible conversion but instead have an actual conversion function.

IMO the other direction should probably not be straight binary
compatible either; instead it ought to flip the bit that says "I'm a
CIDR value".

So fixing this requires a couple of new functions and some pg_cast
changes. Since we already forced initdb for beta4, there is a window of
opportunity to do that without any extra pain for beta testers, but the
fix would have to happen *now*.

> Not sure how serious this is since we have gotten few complaints about
> it but clearly it should be fixed.

Personally I'm inclined to leave it for 8.1. The inet/cidr code is
really designed around the assumption that these datatypes are
interchangeable, and I suspect that enforcing a stronger distinction
will actually take much more wide-ranging changes than just this.
Do all of the functions on inet/cidr take care to deliver a value that
is both correctly marked and declared as the correct type? I doubt it.
It needs some thought not just a band-aid ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-10-08 16:37:52 Re: Log line prefix on win32
Previous Message Bruce Momjian 2004-10-08 15:56:27 Re: APR 1.0 released