classful cidr insertion bug? - Mailing list pgsql-bugs

From Paul Schultz
Subject classful cidr insertion bug?
Date
Msg-id Pine.LNX.4.44.0206162014160.3821-100000@elvis.kravshera.net
Whole thread Raw
Responses Re: classful cidr insertion bug?
List pgsql-bugs
I'm running into an issue that contradicts how pgsql should behave
according to the documentation.  Running 7.2.1 .deb package.

For the cidr data type it says an insertion missing the subnet bits should
be handled like legacy classful networks.  ie if I insert just
'172.16.0.0' it should be handled as '172.16.0.0/16'.  I'm seeing it get
inserted as '172.16.0.0/32'.

If i insert using for example '172.16' it works and inserts as a /16, so
does classful insertion only work when inputting with an abbreviated
network (and why the choice to have it restricted like that)?  The data
being stored is essentially a selective parsing of an  entire BGP table
from a Cisco router, so legacy class a/b/c space with  8/16/24 bit
netmasks respectively show up without the prefix length bits.


niara=# \d prefixes
                                     Table "prefixes"
  Column   |          Type          |                      Modifiers
-----------+------------------------+-----------------------------------------------------
 prefix    | cidr                   |
 aspath    | character varying(200) |
 origin_as | integer                |
 id        | integer                | not null default
nextval('"prefixes_id_seq"'::text)
Unique keys: prefixes_id_key

niara=# insert into prefixes values ('129.10.0.0', '10913 1239 1 i', '1');
INSERT 415033 1
niara=# select prefix from prefixes where prefix = '129.10.0.0';
    prefix
---------------
 129.10.0.0/32
(1 row)



Thanks,

Paul Schultz

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Documentation regarding %ROWTYPE in PL/PgSQL
Next
From: Tom Lane
Date:
Subject: Re: classful cidr insertion bug?