Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support - Mailing list pgsql-committers

From Neil Conway
Subject Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support
Date
Msg-id 429F146D.6010701@samurai.com
Whole thread Raw
In response to Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support  (Pavel Stehule <stehule@kix.fsv.cvut.cz>)
Responses Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support
Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support
List pgsql-committers
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 this earlier: I don't think exact Oracle
compatibility is _at all_ important. This feature won't be bug-for-bug
compatible with Oracle in any case (e.g. SQLSTATE vs. SQLERRM) -- I
think we should implement what makes the most sense, as long as it
provides functionality more or less equivalent to what Oracle does.

As for "what makes the most sense", I like Tom's proposal here:

http://archives.postgresql.org/pgsql-committers/2005-05/msg00311.php

i.e. make SQLSTATE and SQLERRM const variables that are local to
EXCEPTION blocks, and make accessing them outside an EXCEPTION block
yield an error.

Does this sound reasonable to people?

-Neil

pgsql-committers by date:

Previous
From: meskes@svr1.postgresql.org (Michael Meskes)
Date:
Subject: pgsql: Fixed memory leak in ecpglib by adding some missing free()
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Add PL/pgSQL SQLSTATE and SQLERRM support