Skip site navigation (1) Skip section navigation (2)

Re: Summary: what to do about INET/CIDR

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Larry Rosenman <ler(at)lerctr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Summary: what to do about INET/CIDR
Date: 2000-10-28 03:08:58
Message-ID: Pine.BSO.4.10.10010272255510.2291-100000@spider.pilosoft.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Fri, 27 Oct 2000, Tom Lane wrote:

> A more interesting question is whether the system needs to provide any
> assisting functions that aren't there now.  The lookup function you guys
> are postulating seems like it would be (in the simple cases)
> 	create function my_network(inet) returns cidr as
> 	'select network from my_networks where ???'
as in my mail:
select network from my_network where network>>$1 order by
network_prefix(network) desc limit 1;

(i.e. if many networks cover the ip address, pick the one with longest
prefix). The only hard question here, how to properly index this table.
This sounds like a perfect application of user-defined index method. 
I need to look up documentation on how they work...


However, this probably won't pose a major problem in production: the
networks table will be relatively small. 

> Maybe it's too late at night, but I'm having a hard time visualizing
> what the ??? condition is and whether any additional system-level
> functions are needed to make it simple/efficient.

Actually, you can scratch my proposal. I realise it could be inconvenient
for some people.

I'll be probably putting all my hosts as inet::xxx/32, have the above
lookup function to get real network, and do operations on that.




In response to

Responses

pgsql-hackers by date

Next:From: Alex PilosovDate: 2000-10-28 03:27:38
Subject: Re: Summary: what to do about INET/CIDR
Previous:From: Larry RosenmanDate: 2000-10-28 03:06:12
Subject: Re: Summary: what to do about INET/CIDR

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group