From: thhal at mailblocks.com (Thomas Hallgren) Date: Tue, 11 Jan 2005 08:15:54 +0100 Subject: [Pljava-dev] Trigger In-Reply-To: <5F4ED4205E00D6119BFE009027DE39090793EFF8@MLSW00103> References: <5F4ED4205E00D6119BFE009027DE39090793EFF8@MLSW00103> <41E37D2A.70303@mailblocks.com> Message-ID: Nageshwar Rao wrote: >Hi, >Now I am having a basic doubt. The trigger is after insert trigger for each >row. When the calling function fails, there is no record inserted in the >table. Does this mean that it is rolled back when the trigger function >fails? > > Using PosgreSQL versions prior to 8.0 the answer would be yes. The transaction is always completely rolled back when an error occurs. In 8.0, savepoints are introduced. They give you a chance to cope with errors and roll back partially. A trigger can set a savepoint internally and roll back to that point if it fails and then continue the transaction. Regards, Thomas Hallgren