inet and cidr type problems

From: jim(at)reptiles(dot)org (Jim Mercer)
To: pgsql-general(at)postgreSQL(dot)org
Subject: inet and cidr type problems
Date: 1999-03-04 04:40:40
Message-ID: m10IPw8-00080dC@mailbox.reptiles.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

i have been playing with the inet and cidr types, and i have noticed a couple
problems, and would entertain suggestions as to how to fix them without
necessarily breaking how other people might be using them.

- a table with an element of type inet, will show "0.0.0.0/0" as "00/0"

i suspect this can be fixed in src/backend/adt/network.c or some such.

- when creating a table with either type inet or type cidr as a primary, unique
key, the elements "198.68.123.0/24" and "198.68.123.0/27" are considered
equal.

i considered editing src/backend/adt/network.c and changing the various
comparison functions to take the subnet bits into account, but i wasn't sure
what the proper fix is.

my feeling is to make "/27" to be greater than "/24", such that when fetching
in order, the "/24" will come first.

if i make such changes to the source, will it break other people's code if
the changes get added to the core source (6.4.3 or 6.5)?

--
[ Jim Mercer Reptilian Research jim(at)reptiles(dot)org +1 416 410-5633 ]
[ The telephone, for those of you who have forgotten, was a commonly used ]
[ communications technology in the days before electronic mail. ]
[ They're still easy to find in most large cities. -- Nathaniel Borenstein ]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ulf Mehlig 1999-03-04 08:56:17 information about primary key from sys tabs
Previous Message Thomas G. Lockhart 1999-03-04 02:33:01 Re: [HACKERS] NUMERIC and Perl

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 1999-03-04 08:43:38 Re: [HACKERS] Tom Lane's fixes in v6.4.3
Previous Message Tatsuo Ishii 1999-03-04 03:51:15 Re: [HACKERS] Re: Tcl/Tk config (was: int 8 on FreeBSD)