Re: plpgsql error handling bug

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: plpgsql error handling bug
Date: 2004-09-05 20:57:01
Message-ID: 413B7D9D.1060305@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:

> Ivan-Sun1(at)mail(dot)ru writes:
>
>>I found a bug in the behaviour of plpgsql error handling system
>>while trying to handle foreign key violation exception.
>
>
> This is not a bug in the exception system.
>
> The problem is that FK constraints are enforced by triggers that do not
> fire until the end of the outer statement (that is, the SELECT that
> calls the plpgsql function). So by the time the constraint error is
> raised, we have long since exited the exception structure.
>
> There has been some talk of changing trigger firing rules to make this
> sort of thing behave more intuitively inside functions, but it hasn't
> happened yet.
>
> Maybe we should think about doing something about this for 8.0? It's a
> larger behavioral change than I like to think about for post-beta, but
> (a) the exception mechanism's usefulness is certainly going to be
> severely limited if it can't catch FK errors; (b) 8.0 seems like a
> more appropriate time to introduce backwards-incompatibilities than
> future 8.x releases.

Considering also that if you fix the BUG #1231 then 8.0 have already some
backwards-incompatibilities so one more is mitigated by the other one.

Regards
Gaetano Mendola

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-09-06 01:49:08 Re: Permissions problem with sequences
Previous Message Tom Lane 2004-09-05 17:23:12 Re: plpgsql error handling bug