BUG #2946: server crashes when trying to catch exception in function

Поиск
Список
Период
Сортировка
От
Тема BUG #2946: server crashes when trying to catch exception in function
Дата
Msg-id 200701311513.l0VFDdqi026741@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #2946: server crashes when trying to catch exception in function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      2946
Logged by:
Email address:      chris@icp.pl
PostgreSQL version: 8.2.0
Operating system:   Red Hat Enterprise Linux ES release 4
Description:        server crashes when trying to catch exception in
function
Details:

I have a function named test()

CREATE OR REPLACE FUNCTION test()
  RETURNS integer AS
$BODY$
DECLARE
     r INTEGER;
    y INTEGER;
    x INTEGER;
BEGIN
    BEGIN
        select into r 1;
        y := r / 0;
        EXCEPTION
        WHEN OTHERS THEN
        NULL;
    END;
    RETURN y;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


select * from test() causes a server crash


when I change

select into r 1;  to  r:=1;

all works fine.



there can be a

select into r id FROM some_table LIMIT 1;

or

WHEN division_by_zero THEN


and the server srashes too.


Chris.

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

Предыдущее
От: "Maarten van der Heijden"
Дата:
Сообщение: Re: Troubles in Initializing Postgres Database 8.2
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2946: server crashes when trying to catch exception in function