From: mikael-aronsson <mikael-aronsson@telia.com>
To: deepthi@granwill.com
To: pgsql-jdbc@postgresql.org
Subject: Re: Maximum limit on int in plpgsql
Date: Tue, 30 Nov 2004 11:14:17 +0100
Message-ID: <002a01c4d6c5$5b0ebb50$bf95d1d9@w128mtec> (raw)
References: <1101808087.41ac41d7382a9@granwill.com>
Hi !
pg_atoi sounds like a function that converts from a string to an integer so
the problem would be with the cast in that case, even though I cannot see
any problem with your example.
Mikael
----- Original Message -----
From: <deepthi@granwill.com>
To: <pgsql-jdbc@postgresql.org>
Sent: Tuesday, November 30, 2004 10:48 AM
Subject: [JDBC] Maximum limit on int in plpgsql
> Hello,
>
> I am passing the ip address as a varchar. Eg: 133.9.4.11
>
> Later on i am splitting the ip address with the delimiter as '.'
>
>
> ip1t:= split_part($1,'.',1); // returns a text value
> ip2t:= split_part($1,'.',2); // returns a text value
> ip3t:= split_part($1,'.',3);
> ip4t:= split_part($1,'.',4);
>
> Then i am type casting it into an integer
>
> select into ip1 cast(ip1t as integer);
> select into ip2 cast(ip2t as integer);
> select into ip3 cast(ip3t as integer);
> select into ip4 cast(ip4t as integer);
>
> The i am taking the sum using this formula
>
> out_sum=ip1*256*256*256+ip2*256*256+ip3*256+ip4;
>
> When i run the procedure i am getting following error
> pg_atoi : Numerical result out of range
>
> I tried all possible datatypes but still i am getting the same error.
>
> Is it the problem of typecasting or the limits on datatype?
>
> Thank you in advance,
> deepthi
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mikael-aronsson@telia.com, deepthi@granwill.com
Subject: Re: Maximum limit on int in plpgsql
In-Reply-To: <002a01c4d6c5$5b0ebb50$bf95d1d9@w128mtec>
References: <1101808087.41ac41d7382a9@granwill.com> <002a01c4d6c5$5b0ebb50$bf95d1d9@w128mtec>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox