Re: BUG #4277: Feature request inet type cast numeric values - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: BUG #4277: Feature request inet type cast numeric values
Date
Msg-id 486A52F4.6070309@enterprisedb.com
Whole thread Raw
In response to BUG #4277: Feature request inet type cast numeric values  ("x" <noreply@postgresql.org>)
Responses Re: BUG #4277: Feature request inet type cast numeric values
List pgsql-bugs
x wrote:
> Description:        Feature request inet type cast numeric values
> Details:
>
> SELECT inet 2130706433;
>
> Should return:
> ?column?
> --------
> 127.0.0.1
>
> This would emulate the functionality:
> CREATE OR REPLACE FUNCTION inet_ntoa(bigint) RETURNS text AS '
> SELECT (($1>>24) & 255::int8) || ''.'' ||
> (($1>>16) & 255::int8) || ''.'' ||
> (($1>>8) & 255::int8) || ''.'' ||
> ($1 & 255::int8) as result
> '
> LANGUAGE 'SQL';

You can create the cast yourself if you want to, see CREATE CAST.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-bugs by date:

Previous
From: "x"
Date:
Subject: BUG #4277: Feature request inet type cast numeric values
Next
From: Tom Lane
Date:
Subject: Re: BUG #4277: Feature request inet type cast numeric values