Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-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

pgsql-committers by date

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

pgsql-patches by date

Next:From: Neil ConwayDate: 2005-05-26 14:15:07
Subject: Re: O_DIRECT for WAL writes
Previous:From: a_ogawaDate: 2005-05-26 14:01:37
Subject: Re: wchareq improvement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group