Re: INET/CIDR types
От | Larry Rosenman |
---|---|
Тема | Re: INET/CIDR types |
Дата | |
Msg-id | 200007250310.e6P3A1v13825@lerami.lerctr.org обсуждение исходный текст |
Ответ на | Re: INET/CIDR types (Alex Pilosov <alex@pilosoft.com>) |
Ответы |
Re: INET/CIDR types
|
Список | pgsql-hackers |
The bad news is it doesn't work now... ler=# select host(netblock::int8::inet) from networks; ERROR: Cannot cast type 'cidr' to 'int8' ler=# \d networks Table "networks" Attribute | Type | Modifier ---------------+--------------+---------- netblock | cidr | router | integer | interface | varchar(64) | dest_ip | inet | net_name | varchar(64) | owner | integer | origin | varchar(256) | assigned_date | date | assigned_by | varchar(64) | asn | smallint | ler=# > On Mon, 24 Jul 2000, Larry Rosenman wrote: > > > > This whole discussion is quite silly guys. > > > > > > It is quite reasonable to have ability to split CIDR net into two pieces: > > > the network and the bitshift. Second one is already possible, the first > > > one can be accomplished by having functions to convert a cidr/inet to int8 > > > (not int4 because of sign thing), and back. > > > > > > Its also very easy to implement ;) > > > > > > This will actually come very useful for many applications. Something I'm > > > working on now (allocation of 'most appropriate' block) requires ability > > > to split a netblock into two, which could be most easily accomplished > > > using int8 math. (net::int8+2^(netmask(net)-1)). > > All I'm looking for is to be able to print all 4 octets of an IP address > > out so that joe user can take the 4 numbers and type it into the > > 4 boxes on a Windows 98 box, and use them. > > > > Is that really that abhorrent? > > > > They also need the 4 octet netmask which I can get now. > > > > All we are missing is a way to print ALL 4 NUMBERS ALL THE TIME > > for the output. It's not asking for classful, and for sure > > we use CIDR all over the place, but for the final output that my > > users see, why can't I have the database just print all 4 octets? > > Larry, > With my suggestion, you can do it as follows: > > net::int8::inet > > (net being of cidr type) > -alex > -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
В списке pgsql-hackers по дате отправления: