Re: Maximum limit on int in plpgsql

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Maximum limit on int in plpgsql
Дата
Msg-id 41AC654D.8050503@archonet.com
обсуждение исходный текст
Ответ на Maximum limit on int in plpgsql  (deepthi@granwill.com)
Список pgsql-general
deepthi@granwill.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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Nefnifi, Kasem"
Дата:
Сообщение: starting the database server
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: starting the database server