| From: | "" <chris(at)icp(dot)pl> | 
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org | 
| Subject: | BUG #2946: server crashes when trying to catch exception in function | 
| Date: | 2007-01-31 15:13:39 | 
| Message-ID: | 200701311513.l0VFDdqi026741@wwwmaster.postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged online:
Bug reference:      2946
Logged by:          
Email address:      chris(at)icp(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sergiy Vyshnevetskiy | 2007-01-31 15:49:45 | Re: BUG #2945: possibly forgotten SPI_push()/SPI_pop() | 
| Previous Message | Maarten van der Heijden | 2007-01-31 11:47:01 | Re: Troubles in Initializing Postgres Database 8.2 |