From: thomas at tada.se (Thomas Hallgren) Date: Thu, 18 May 2006 09:35:33 +0200 Subject: [Pljava-dev] Problem with primary key In-Reply-To: <446C1EE3.2030605@insa-toulouse.fr> References: <4469E7C0.4040502@insa-toulouse.fr> <4469F3E6.6070802@tada.se> <446C1EE3.2030605@insa-toulouse.fr> Message-ID: <446C23C5.207@tada.se> Eric BOYER wrote: > Thomas Hallgren a ?crit : > >> Eric, >> You say that you re-throw the exception in your catch. Yet, in your >> example you don't do that. Also, to do an e.printStackTrace() might >> be a bad idea sometimes. If the postmaster runs as a service, there >> will be no System.out assigned. >> >> > It was a simple test. In reality, we use log4j ! Really? Why is that? You are aware that PL/Java is adapting the standard java.util.logging stuff on top of the PostgreSQL logger? More info here: http://wiki.tada.se/display/pljava/Logging > OK but we wan't catch exception for different reasons ... You must use savepoints if you plan to catch SQLExceptions without throwing them again (see: http://wiki.tada.se/display/pljava/Exception+handling). If you don't it really shouldn't matter if you catch a ServerException (the subclass of SQLException that you must have encountered). That exception will always be re-thrown and cause a rollback once your method returns. And that's regardless of if you catch it or not. The fact that the backend reached an unstable state actually indicates a bug in PL/Java. My guess is that the endless recursion that you caused somehow messed up the internal error handling. I'll look into that. Regards, Thomas Hallgren