BUG #1608: integer negative limit in plpgsql function arguments

Поиск
Список
Период
Сортировка
От Paul
Тема BUG #1608: integer negative limit in plpgsql function arguments
Дата
Msg-id 20050420144651.3BDEAF0F4C@svr2.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #1608: integer negative limit in plpgsql function arguments  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1608
Logged by:          Paul
Email address:      paul@allinea.com
PostgreSQL version: 8.0.2
Operating system:   Gentoo and Fedora Core 3
Description:        integer negative limit in plpgsql function arguments
Details:

The script below best sums up the problem (and the work around).  The
question is: should I use that for all integers being put into a function?

8<--------------------------------------------

create table test (
    test_id integer
);

insert into test (test_id) values (-2147483648);

create function print_test_id (integer) returns integer
    AS '
DECLARE
    tmp ALIAS FOR $1;
    val integer;
BEGIN
    select into val test_id from test where test_id = tmp;
    return val;
END;
'
    LANGUAGE plpgsql;

-- this doesn't work (and I think it should!)
SELECT print_test_id(-2147483648);

-- this is the workaround
SELECT print_test_id((-2147483648)::int);

-------------------------------------------->8

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: How Ican to upgrade to Latest Version of postgresql
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1608: integer negative limit in plpgsql function arguments