Re: [COMMITTERS] pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support
Date: 2005-05-26 04:11:17
Message-ID: 200505260411.j4Q4BHe23279@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-patches


Patch backed out, and new combined version attached.

---------------------------------------------------------------------------

Tom Lane wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
> > Tom Lane wrote:
> >> Alternatively we could make them local to any block that contains an
> >> EXCEPTION clause, which would fix point 3 and also go a long way towards
> >> addressing the unnecessary-overhead gripe. However that would mean that
> >> an attempt to reference them from outside an exception handler would
> >> probably fail outright, rather than deliver either NULLs or
> >> 00000/"Successful completion".
>
> > This behavior sounds fine to me.
>
> I think the key distinction between this proposal and my other one
> (that SQLSTATE/SQLERRM be procedure-local) is whether you want the error
> status to be available to code that immediately follows the BEGIN block
> containing the exception handler. That is, consider code like
>
> BEGIN
> -- do something perilous
> EXCEPTION
> WHEN OTHERS THEN -- nothing much
> END;
> IF SQLSTATE = '42000' THEN ...
>
> At the moment I don't have a strong opinion about this. It seems
> closely analogous to the question whether a loop iteration variable
> should remain defined after the loop exits --- you can find cases
> where that's handy, but you can also argue it shouldn't be used.
> plpgsql itself is schizophrenic on the point (see integer versus
> record FOR-loops), which means we don't have a solid precedent to go by.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 9.6 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2005-05-26 06:38:55 Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values
Previous Message Bruce Momjian 2005-05-26 04:08:32 pgsql: Back out SQLSTATE and SQLERRM support.

Browse pgsql-patches by date

  From Date Subject
Next Message Jaime Casanova 2005-05-26 04:19:03 Remove second argument from textToQualifiedNameList
Previous Message Tom Lane 2005-05-26 04:00:24 Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support