plpgsql error handling bug - Mailing list pgsql-bugs

From Ivan-Sun1@mail.ru
Subject plpgsql error handling bug
Date
Msg-id 52359326.20040905152502@mail.ru
Whole thread Raw
Responses Re: plpgsql error handling bug  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: plpgsql error handling bug  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hello.

I found a bug in the behaviour of plpgsql error handling system
while trying to handle foreign key violation exception.

When this error occured, control doesn't jump to exception handling block.
It moves to the next statement instead. When control leaves the
function exception is occured. So it's impossible to handle this kind of
exception.

Furthermore, the FOUND local variable is set to true after insert
statement which raises foreign key violation and
GET DIAGNOSTICS var = ROW_COUNT set var to 1.

Attached file contains sample that shows this bug.
Execute fk_violation_bug, fk_violation_bug2 and fk_violation_bug3
plpgsql functions to see this error.

---------
I'm using

"PostgreSQL 8.0.0beta1 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.2.3 (mingw special 20030504-1)"

on

OS Name Microsoft Windows XP Professional
Version 5.1.2600 Service Pack 2 Build 2600

Thank you.

--
Best regards,
 Ivan                          mailto:Ivan-Sun1@mail.ru
Attachment

pgsql-bugs by date:

Previous
From: Harald Armin Massa
Date:
Subject: Failed to connect to database - further investigations
Next
From: Tom Lane
Date:
Subject: Re: readline selection (was Re: [GENERAL] psql leaking? - SOLVED)