BUG #3064: In Stored Procedures (pgplgql - Mailing list pgsql-bugs

From Fridman Garri
Subject BUG #3064: In Stored Procedures (pgplgql
Date
Msg-id 200702231714.l1NHEpkC037309@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #3064: In Stored Procedures (pgplgql  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      3064
Logged by:          Fridman Garri
Email address:      garri@wanadoo.nl
PostgreSQL version: 8.2.0
Operating system:   WinXP-Prof
Description:        In Stored Procedures (pgplgql
Details:

A PSQL 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.


-- 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

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #2969: Inaccuracies in Solaris FAQ
Next
From: "Craig White"
Date:
Subject: Re: BUG #3032: Commit hung for days