Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values
Date: 2005-05-26 14:10:50
Message-ID: 27289.1117116650@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Does Oracle support GET DIAGNOSTICS? If so, couldn't we just use that?
> I can't see what good will become of making any slightly useful
> information become available as magic variables of some kind.

Oracle actually defines these things as parameterless functions that are
called without parentheses (like CURRENT_USER). "Magic variables" are
about as close as we can get to matching that.

If we go with the idea that they should be local to blocks containing
EXCEPTION, then the easiest implementation would involve pushing them
into the namespace at the beginning of processing the EXCEPTION clause;
which'd mean they are actually physically inaccessible anywhere outside
EXCEPTION. That seems like a suitably narrow API --- in fact it
completely gets rid of the question of what their initial/default values
should be. I think we can mark 'em CONST, too, so that they are truly
semantically indistinguishable from functions.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2005-05-26 15:26:00 pgsql: Back out: Display only 9 not 10 digits of precision for
Previous Message Pavel Stehule 2005-05-26 07:19:51 Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2005-05-26 14:15:07 Re: O_DIRECT for WAL writes
Previous Message a_ogawa 2005-05-26 14:01:37 Re: wchareq improvement