Re: New cast between inet/cidr and bytea

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: New cast between inet/cidr and bytea
Date: 2007-05-31 05:50:15
Message-ID: 465E6217.7080008@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane írta:
> Zoltan Boszormenyi <zb(at)cybertec(dot)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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2007-05-31 07:52:29 Re: ERROR: index row size 2960 exceeds btree maximum
Previous Message Zoltan Boszormenyi 2007-05-31 05:31:48 Re: New cast between inet/cidr and bytea