Re: proposal: catch warnings

From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: simon(at)2ndquadrant(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: proposal: catch warnings
Date: 2007-01-07 14:52:29
Message-ID: BAY20-F2247A8F378C93AEFCF394EF9BD0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> > >
> > >Does the PSM warning error handler run in the same transaction or a
> > >separate subtransaction? Can transaction execution continue afterwards?
> > >
> >
> > It's depend. Continue and exit warning handlers run in the same
>transaction,
> > undo handler has separate subtransaction. It works well. For patterns
>used
> > in SQL/PSM is important fast continue handler for SQLSTATE '02000' (not
> > found).
>
>Hmmm. SQLSTATE 02000 NO_DATA doesn't seem to be raised anywhere by the
>backend, though it is listed by ECPG.
>
>Are you thinking of the special variable FOUND, which doesn't raise an
>exception in PL/pgSQL, or the PostgreSQL PL/pgSQL exception:
>NO_DATA_FOUND (SQLSTATE P0002) which isn't actually an SQL ERROR at all.
>(Definitely an exception in PL/SQL?)
>
>ISTM that if we have an exception defined like this in PL/pgSQL
>
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> block
> END;
>
>that we wouldn't need to wrap it in a sub-transaction, because the
>earlier statements need not be rolled back when it occurs. Perhaps you
>can scan for this condition in the PSM code, rather than getting the
>backend to throw a different kind of error?
>

FOUND is only one value, but I have to detect all values from sqlstate
classes '02' and '01'. Without backend change I am not able catch warnings
from other PL. Hook is general solution.

Pavel

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-01-07 15:03:28 Re: SGML index build fix
Previous Message Bruce Momjian 2007-01-07 14:50:07 Re: [HACKERS] SGML index build fix