Unix Technical Forum

BUG #4277: Feature request inet type cast numeric values

This is a discussion on BUG #4277: Feature request inet type cast numeric values within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 4277 Logged by: x Email address: noreply@postgresql.org PostgreSQL version: n/a ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-01-2008, 06:02 PM
x
 
Posts: n/a
Default BUG #4277: Feature request inet type cast numeric values


The following bug has been logged online:

Bug reference: 4277
Logged by: x
Email address: noreply@postgresql.org
PostgreSQL version: n/a
Operating system: n/a
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';

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-01-2008, 06:02 PM
Heikki Linnakangas
 
Posts: n/a
Default Re: BUG #4277: Feature request inet type cast numeric values

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

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-01-2008, 06:02 PM
Tom Lane
 
Posts: n/a
Default Re: BUG #4277: Feature request inet type cast numeric values

"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
>> Description: Feature request inet type cast numeric values


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


The proposed cast seems rather inappropriate in an IPv6 world anyway.
If you want IPv4-only functionality, I think the inet4 type on
pgfoundry has this behavior already.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:34 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com