Re: Summary: what to do about INET/CIDR

Поиск
Список
Период
Сортировка
От Alex Pilosov
Тема Re: Summary: what to do about INET/CIDR
Дата
Msg-id Pine.BSO.4.10.10010272255510.2291-100000@spider.pilosoft.com
обсуждение исходный текст
Ответ на Summary: what to do about INET/CIDR  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alex Pilosov
Дата:
Сообщение: Re: Re: [GENERAL] A rare error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Summary: what to do about INET/CIDR