Thread:

From
Florian Ledoux
Date:
Hello,

Having freshly installed a PG database (8.0.3), I have difficulties in
tracing exceptions in my PL/pgSQL functions. All my functions
implement a BEGIN-EXCEPTION-END block in which exceptions must be
traced :
BEGIN
   -- Some stuff
EXCEPTION
  WHEN OTHERS THEN
      -- trace
END;

I would like to trace the SQLCODE that triggers the exception. I have
heard about a SQLSTATE variable but it doesn't seem to be implemented
in the 8.0.3 but only in the 8.1 (not stable release and so not a good
choice in a professional context...).

How can I get this information ? Is there a patch available ? Is there
a workaround ?

Thanks