plpgsql error handling bug

From: Ivan-Sun1(at)mail(dot)ru
To: pgsql-bugs(at)postgresql(dot)org
Subject: plpgsql error handling bug
Date: 2004-09-05 11:25:02
Message-ID: 52359326.20040905152502@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mail(dot)ru

Attachment Content-Type Size
bug.sql text/plain 4.1 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-09-05 16:21:58 Re: Permissions problem with sequences
Previous Message Harald Armin Massa 2004-09-05 10:20:39 Failed to connect to database - further investigations