Re: inet to bigint?
От
Michael Fuhr
Тема
Re: inet to bigint?
Дата
Msg-id
20051206074428.GA76801@winnie.fuhr.org
Ответ на
inet to bigint? (Christopher Kings-Lynne)
Список
Дерево обсуждения
inet to bigint? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: inet to bigint? Michael Fuhr <mike@fuhr.org>
Re: inet to bigint? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: inet to bigint? Michael Fuhr <mike@fuhr.org>
Re: inet to bigint? Michael Fuhr <mike@fuhr.org>
Re: inet to bigint? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Re: inet to bigint? Michael Fuhr <mike@fuhr.org>
Re: inet to bigint? hubert depesz lubaczewski <depesz@gmail.com>
On Tue, Dec 06, 2005 at 03:31:59PM +0800, Christopher Kings-Lynne wrote:
> OK, I give up - how do I convert an INET type to a NUMERIC
> representation of its network address?
How about:
CREATE FUNCTION inet2num(inet) RETURNS numeric AS $$
use Socket;
return unpack("N", inet_aton($_[0]));
$$ LANGUAGE plperlu IMMUTABLE STRICT;
SELECT inet2num('127.0.0.1'); inet2num
------------2130706433
(1 row)
--
Michael Fuhr
В списке pgsql-hackers по дате отправления