[BUGS] server crash: displaying sqlerrm in exception block
PostgreSQL version: 8.2.1 Operating system: Fedora 3 Description:server crash Details: I have compiled postgres 8.2.1 with gcc 4.1. and when executed this function it crashes the server. i also fetched the code from postgres repository (8.3devel) and tested this code but it still crashing server. Steps to produce -- CREATE OR REPLACE FUNCTION func2() RETURNS int as $$ BEGIN RAISE EXCEPTION 'ex -'; EXCEPTION WHEN OTHERS THEN RAISE INFO 'sql error msg %',sqlerrm; DECLARE v_msg VARCHAR(200) := sqlerrm; BEGIN RAISE INFO 'sql error msg %',sqlerrm; ENd; RETURN 0; END; $$ LANGUAGE plpgsql; select func2(); Output - INFO: sql error msg ex - 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.
Re: [BUGS] server crash: displaying sqlerrm in exception block
here is the test case CREATE OR REPLACE FUNCTION func() RETURNS int as $$ BEGIN RAISE EXCEPTION 'ex -'; EXCEPTION WHEN OTHERS THEN RAISE INFO 'sql error msg %',sqlerrm; DECLARE v_msg VARCHAR(200) := sqlerrm; BEGIN RAISE INFO 'sql error msg %',sqlerrm; -- it show's RAISE INFO 'sql error v_msg %',v_msg; -- it show's ENd; RETURN 0; END; $$ LANGUAGE plpgsql; Regards, --Asif On 2/8/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Asif Ali" <[EMAIL PROTECTED]> writes: > your patch fixes the crash but instead of displaying the sqlerrm value, it > is displaying in > pl block, declared inside exception block. Hm, not what I see here. Could you submit a test case that does that? regards, tom lane -- Regards, --Asif Ali Rehman
Re: [BUGS] server crash: displaying sqlerrm in exception block
Hi, well i just updated the code and found your patch is applied in there and it's working. may be i missed something while applying your patch. Regards, --Asif On 2/8/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Asif Ali" <[EMAIL PROTECTED]> writes: > here is the test case It works for me: regression=# select func(); INFO: sql error msg ex - INFO: sql error msg ex - INFO: sql error v_msg ex - func -- 0 (1 row) Are you sure you applied the patch correctly? In particular, you'd need a working version of bison to rebuild the gram.y file --- the behavior you're reporting sounds like what would happen if that hadn't gotten rebuilt. regards, tom lane -- Regards, --Asif Ali Rehman