Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values
Date
Msg-id 27289.1117116650@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-committers
Peter Eisentraut <peter_e@gmx.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

pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values
Next
From: momjian@svr1.postgresql.org (Bruce Momjian)
Date:
Subject: pgsql: Back out: Display only 9 not 10 digits of precision for