pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedMaximum limit on int in plpgsql
3+ messages / 3 participants
[nested] [flat]
* Maximum limit on int in plpgsql
@ 2004-11-30 09:48 deepthi@granwill.com
2004-11-30 09:57 ` Re: Maximum limit on int in plpgsql Kris Jurka <books@ejurka.com>
2004-11-30 10:14 ` Re: Maximum limit on int in plpgsql mikael-aronsson <mikael-aronsson@telia.com>
0 siblings, 2 replies; 3+ messages in thread
From: deepthi@granwill.com @ 2004-11-30 09:48 UTC (permalink / raw)
To: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Maximum limit on int in plpgsql
2004-11-30 09:48 Maximum limit on int in plpgsql deepthi@granwill.com
@ 2004-11-30 09:57 ` Kris Jurka <books@ejurka.com>
1 sibling, 0 replies; 3+ messages in thread
From: Kris Jurka @ 2004-11-30 09:57 UTC (permalink / raw)
To: deepthi@granwill.com; +Cc: pgsql-jdbc
On Tue, 30 Nov 2004 deepthi@granwill.com wrote:
> When i run the procedure i am getting following error
> pg_atoi : Numerical result out of range
http://www.postgresql.org/docs/7.4/static/datatype.html#DATATYPE-NUMERIC
This question has nothing to do with JDBC or Java and is not appropriate
for this list. Please try pgsql-general@postgresql.org for this type of
question.
Kris Jurka
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Maximum limit on int in plpgsql
2004-11-30 09:48 Maximum limit on int in plpgsql deepthi@granwill.com
@ 2004-11-30 10:14 ` mikael-aronsson <mikael-aronsson@telia.com>
1 sibling, 0 replies; 3+ messages in thread
From: mikael-aronsson @ 2004-11-30 10:14 UTC (permalink / raw)
To: deepthi@granwill.com; pgsql-jdbc
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-11-30 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-30 09:48 Maximum limit on int in plpgsql deepthi@granwill.com
2004-11-30 09:57 ` Kris Jurka <books@ejurka.com>
2004-11-30 10:14 ` mikael-aronsson <mikael-aronsson@telia.com>
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