Re: bigint to ip - Mailing list pgsql-general

From Jasen Betts
Subject Re: bigint to ip
Date
Msg-id h63akv$12v$1@reversiblemaps.ath.cx
Whole thread Raw
In response to bigint to ip  ("Mindaugas G." <mindaugas@biovela.lt>)
List pgsql-general
On 2009-08-09, Mindaugas G. <mindaugas@biovela.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;





pgsql-general by date:

Previous
From: Radoslaw Zielinski *EXTERN*
Date:
Subject: Re: 8.4.0 bug - failure to enforce a foreign key constraint
Next
From: "Marc Mamin"
Date:
Subject: FILLFACTOR for GIN indexes in 8.3.7