plPgSQL + CDIR/INET types ...
plPgSQL + CDIR/INET types ...
От:
"Marc G. Fournier" <scrappy@hub.org>
Дата:
Has anyone either played with, or gotten to work, a plPgSQL function that would take: 192.168.1.1/24 and determine the start and end IP from that? Or even start IP + # of IPs in the subnet? ---- Marc G. Fournier Hub.Org Hosting Solutions S.A. scrappy@hub.org http://www.hub.org Yahoo:yscrappy Skype: hub.org ICQ:7615664 MSN:scrappy@hub.org
Re: plPgSQL + CDIR/INET types ...
От:
Steve Atkins <steve@blighty.com>
Дата:
On Mar 30, 2010, at 7:09 PM, Marc G. Fournier wrote: > > Has anyone either played with, or gotten to work, a plPgSQL function that would take: 192.168.1.1/24 and determine the start and end IP from that? Or even start IP + # of IPs in the subnet? If that was a valid cidr value (like 192.168.1.0/24) you could just use host() or broadcast() to get the first and last addresses (and subtraction to get the size of the subnet). You could probably convert it to the equivalent cidr range with some combo of set_masklen() and masklen(). Cheers, Steve
Re: plPgSQL + CDIR/INET types ...
От:
Harald Fuchs <hari.fuchs@gmail.com>
Дата:
In article , "Marc G. Fournier" writes: > Has anyone either played with, or gotten to work, a plPgSQL function > that would take: 192.168.1.1/24 and determine the start and end IP > from that? Or even start IP + # of IPs in the subnet? Just install ip4r from pgfoundry, and you'll never look back at the old cidr/inet types.