BUG #3065: Bug in stored procedure EXEPTION handling or in plpgsql ?

From: "Fridman Garri" <garri(at)wanadoo(dot)nl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3065: Bug in stored procedure EXEPTION handling or in plpgsql ?
Date: 2007-02-23 17:26:40
Message-ID: 200702231726.l1NHQeZ5037417@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3065
Logged by: Fridman Garri
Email address: garri(at)wanadoo(dot)nl
PostgreSQL version: 8.2.0
Operating system: WinXP-Prof SP2
Description: Bug in stored procedure EXEPTION handling or in plpgsql
?
Details:

If I call "select message from mytest(5);" from command line or from Admin
III when a programm terminates with a Message:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Stored Procedure "mytest" Created Successfully before running of examples.

Examples of situation:
-- Example 1: no Crash
select message from mytest(-1);

-- Example 2: no Crash
select message from mytest(0);

-- Example 3: no Crash
select message from mytest(2);

-- Example 4: Crash !!!
select message from mytest(5);

-- Used Stored Procedure --
CREATE OR REPLACE FUNCTION mytest(IN amount "int4", OUT message "varchar")
AS

$BODY$

DECLARE
myid integer;
BEGIN
message = 'no errors';

IF amount > 0
THEN
SELECT id INTO myid FROM client WHERE id = 1;
END IF;

IF amount = 0 OR amount = 5
THEN
RAISE EXCEPTION 'error: amount = %', amount;
END IF;

EXCEPTION
WHEN OTHERS THEN
message = SQLERRM;
END;

$BODY$
LANGUAGE 'plpgsql';
ALTER FUNCTION mytest(IN amount "int4", OUT message "varchar") OWNER TO
garri

Best regards.
Garri Fridman.

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2007-02-23 18:32:10 Re: BUG #3038: information_schema.constraint_column_usage has wrong information for foreign keys
Previous Message Fridman Garri 2007-02-23 17:14:51 BUG #3064: In Stored Procedures (pgplgql