Re: New cast between inet/cidr and bytea - Mailing list pgsql-hackers

From Zoltan Boszormenyi
Subject Re: New cast between inet/cidr and bytea
Date
Msg-id 465E6217.7080008@cybertec.at
Whole thread Raw
In response to Re: New cast between inet/cidr and bytea  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane írta:
> Zoltan Boszormenyi <zb@cybertec.at> writes:
>   
>> we at Cybertec have developed cast functions in C between
>> inet/cidr <-> bytea for a client and we would like to submit it.
>>     
>
> Why is this a good idea?  Exposing the internal representation of a
> datatype is usually bad.

I didn't expose the inet/cidr internals.

An IP address is an IP address whether you represent it
textually or as a series of bytes. Since the rise of the CIDR
type netmask usage, there is not much support for netmasks
with holes in the middle of the bits, like 255.255.192.128
on the 'net. And there is no support for this kind of netmask
in PostgreSQL either. So, to don't lose data (the netmask _is_
an important data) we decided to go this way.
A single IP address without the netmask means the netmask
covers the whole 32 or 128 bits in real life, too.

>   What will you do when we add support for
> scoped IPv6 addressing, to take one obvious example?
>   

It can still be represented as a series of bytes, won't it?
Just as in an actual IP packet header.
When the support arrives, I can fix the cast, too, if needed.

>             regards, tom lane
>   

Best regards

-- 
----------------------------------
Zoltán Böszörményi
Cybertec Geschwinde & Schönig GmbH
http://www.postgresql.at/



pgsql-hackers by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: New cast between inet/cidr and bytea
Next
From: OmniPay Company
Date:
Subject: Job Proposal