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

2005-06-05 Thread Pavel Stehule
On Thu, 2 Jun 2005, Tom Lane wrote: > Pavel Stehule <[EMAIL PROTECTED]> writes: > > I din't find easy way how append variable only when block contains > > EXCEPTION part. I wilcome any advice > > I was envisioning an action in the beginning of the EXCEPTION clause, > viz > > exception_sect : >

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

2005-06-05 Thread Pavel Stehule
On Thu, 2 Jun 2005, Tom Lane wrote: > Neil Conway <[EMAIL PROTECTED]> writes: > > I should have commented on this earlier: I don't think exact Oracle > > compatibility is _at all_ important. > > The results of Pavel's experiments prove that Oracle's behavior is > pretty random --- it looks to me

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

2005-06-05 Thread Pavel Stehule
On Fri, 3 Jun 2005, Neil Conway wrote: > Pavel Stehule wrote: > > So we can have only one procedure level scope variable, which is > > initialized on start of exception and zeroized on the end of exception > > block. This behavior is different from my patch, but is better for Oracle > > compati

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

2005-06-02 Thread Tom Lane
Pavel Stehule <[EMAIL PROTECTED]> writes: > On Thu, 2 Jun 2005, Tom Lane wrote: >> The results of Pavel's experiments prove that Oracle's behavior is >> pretty random --- it looks to me like the chance results of whatever > What I can speek. Oracle has session variable for saving err code of last

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

2005-06-02 Thread Tom Lane
Pavel Stehule <[EMAIL PROTECTED]> writes: > I din't find easy way how append variable only when block contains > EXCEPTION part. I wilcome any advice I was envisioning an action in the beginning of the EXCEPTION clause, viz exception_sect : { $$ = NIL; } | K_

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

2005-06-02 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > I should have commented on this earlier: I don't think exact Oracle > compatibility is _at all_ important. The results of Pavel's experiments prove that Oracle's behavior is pretty random --- it looks to me like the chance results of whatever quick-and-di

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

2005-06-02 Thread Neil Conway
Pavel Stehule wrote: So we can have only one procedure level scope variable, which is initialized on start of exception and zeroized on the end of exception block. This behavior is different from my patch, but is better for Oracle compatibility and I prefere its. I should have commented on th

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

2005-05-31 Thread Pavel Stehule
> BEGIN > -- do something perilous > EXCEPTION > WHEN OTHERS THEN -- nothing much > END; > IF SQLSTATE = '42000' THEN ... I understand. My idea was detect local exception for local block, I can't to see exception's information outside block and

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

2005-05-31 Thread Pavel Stehule
> > That might be taking the notion of bug-compatibility with PL/SQL > a bit too far. For that matter, did you check whether Oracle > actually treats it as a procedure-scope variable? Try having the > exception block call another function and trap an error inside that. > Does SQLCODE change in t

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

2005-05-31 Thread Pavel Stehule
On Thu, 26 May 2005, Neil Conway wrote: > 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 attemp

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

2005-05-26 Thread Peter Eisentraut
Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> 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 de

Re: [COMMITTERS] pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support (Really Oracle behavior)

2005-05-26 Thread Tom Lane
Pavel Stehule <[EMAIL PROTECTED]> writes: > What it is mean? I think it means Oracle is broken ;-) > So we can have only one procedure level scope variable, which is > initialized on start of exception and zeroized on the end of exception > block. This behavior is different from my patch, but i

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

2005-05-26 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> 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 parame

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

2005-05-25 Thread Peter Eisentraut
Tom Lane wrote: > I suggest that what we should do is define SQLSTATE and SQLERRM > similarly to FOUND: they are procedure-local variables that are > assigned to by an occurrence of an error. I'd be inclined to make > them start out NULL, too, not 0/"Successful completion". Does Oracle suppor

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

2005-05-25 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> 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

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

2005-05-25 Thread Neil Conway
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 wou

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

2005-05-25 Thread Tom Lane
[EMAIL PROTECTED] (Bruce Momjian) writes: > Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values on > error. I had not taken the time to review this patch before, but now that I have looked at it I'm pretty unhappy with it. It creates new local variables SQLSTATE and SQLERRM in *ever

[COMMITTERS] pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values

2005-05-25 Thread Bruce Momjian
Log Message: --- Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values on error. Pavel Stehule Modified Files: -- pgsql/doc/src/sgml: plpgsql.sgml (r1.67 -> r1.68) (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/plpgsql.sgml.diff