Skip site navigation (1) Skip section navigation (2)

Re: BUG #4277: Feature request inet type cast numeric values

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "x" <noreply(at)postgresql(dot)org>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #4277: Feature request inet type cast numeric values
Date: 2008-07-01 15:53:24
Message-ID: 486A52F4.6070309@enterprisedb.com (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-07-01 16:05:21
Subject: Re: BUG #4277: Feature request inet type cast numeric values
Previous:From: xDate: 2008-07-01 15:20:49
Subject: BUG #4277: Feature request inet type cast numeric values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group