Group: pgsql.sql


Subject: trap for any exception
From: Sabin Coanda
Date: 11/15/2007 3:45:20 PM
Hi there, I'd like to build a PL/pgSQL function which is able to generic trap any error, and interpret it. I read 37.7.5. Trapping Errors, but the syntax requires to write explicitly the exception condition, and not a generic one. Is it possible to build a generic trap or do you know a workaround for that ? TIA, Sabin

Subject: trap for any exception
From: Sabin Coanda
Date: 11/15/2007 3:52:02 PM
> > I read 37.7.5. Trapping Errors, but the syntax requires to write > explicitly the exception condition, and not a generic one. > > Is it possible to build a generic trap or do you know a workaround for > that ? > Sorry, I found the OTHERS condition that trap any error. But the question still remains to find how could I interpret it and found the error code and message ? Sabin

Subject: trap for any exception
From: Sabin Coanda
Date: 11/15/2007 3:54:13 PM
That's ok, I found SQLSTATE and SQLERRM.