Re: Maximum limit on int in plpgsql

From: Richard Huxton <dev(at)archonet(dot)com>
To: deepthi(at)granwill(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Maximum limit on int in plpgsql
Date: 2004-11-30 12:19:25
Message-ID: 41AC654D.8050503@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

deepthi(at)granwill(dot)com wrote:
> I have tried using the int8 also, even then i am having the problem.

Please CC the list.

The following works for me. I suspect your equivalent of "i" is an int4.

CREATE OR REPLACE FUNCTION test_int8(text) RETURNS int8 AS '
DECLARE
i int8;
tot int8;
BEGIN
i := CAST($1 AS int8);
tot := (i * 256 * 256 * 256) + (i * 256 * 256) + (i * 256) + i;
RETURN tot;
END;
' LANGUAGE plpgsql;

SELECT test_int8('255');

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-11-30 12:21:54 Re: starting the database server
Previous Message Nefnifi, Kasem 2004-11-30 11:37:40 starting the database server