Re: bigint to ip

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: bigint to ip
Date: 2009-08-14 09:26:55
Message-ID: h63akv$12v$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-08-09, Mindaugas G. <mindaugas(at)biovela(dot)lt> wrote:
> Hi,
>
> googling few days with no success,
> for example I have db with ip_src etc ant its data type bigint,
> how must look select query what I can see ip address (int) instead of
> bigint?

dunno if this will help.

create function bigint_to_inet(bigint) returns inet as $$
select (($1>>24&255)||'.'||($1>>16&255)||'.'||($1>>8&255)||'.'||($1>>0&255))::inet
$$ immutable language sql;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2009-08-14 09:40:03 Re: Does derby have an embedded Mode like Derby ?
Previous Message Marc Mamin 2009-08-14 09:23:02 FILLFACTOR for GIN indexes in 8.3.7