Re: plPgSQL + CDIR/INET types ...

From: Steve Atkins <steve(at)blighty(dot)com>
To: PostgreSQL - General <pgsql-general(at)postgresql(dot)org>
Subject: Re: plPgSQL + CDIR/INET types ...
Date: 2010-03-31 02:21:17
Message-ID: FC4FC602-BC26-4653-A971-817A3DD4B995@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wojtek 2010-03-31 02:32:10 Unsubscribe
Previous Message Marc G. Fournier 2010-03-31 02:09:09 plPgSQL + CDIR/INET types ...