Re: inet to bigint?

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: inet to bigint?
Дата
Msg-id 4395476E.7020701@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: inet to bigint?  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: inet to bigint?
Список pgsql-hackers
> Sheesh, arbitrary restrictions ;-)  Something like this then:
> 
> CREATE FUNCTION inet2num(inet) RETURNS numeric AS $$
> DECLARE
>     a  text[] := string_to_array(host($1), '.');
> BEGIN
>     RETURN a[1]::numeric * 16777216 + 
>            a[2]::numeric * 65536 + 
>            a[3]::numeric * 256 + 
>            a[4]::numeric;
> END;
> $$ LANGUAGE plpgsql IMMUTABLE STRICT;

Cool, and now the reverse? :D

(I'll credit you in the MySQL Compat Library code btw)  If you're 
interested, you'd be welcome to join the project btw...

Chris



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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: inet to bigint?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: inet to bigint?