Re: [GENERAL] ROLLBACK in a function

2010-05-24 Thread Ken Winter
- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- ow...@postgresql.org] On Behalf Of Craig Ringer Sent: Sunday, May 23, 2010 8:48 PM To: Ken Winter Cc: PostgreSQL pg-general List Subject: Re: [GENERAL] ROLLBACK in a function On 24/05/10 02:51, Ken Winter wrote: How can I write

[GENERAL] ROLLBACK in a function

2010-05-23 Thread Ken Winter
How can I write a PL/PgSQL function that rolls back every database change it has done? I'm about to write a set of database test functions. Each function needs to do some INSERT, UPDATE, or DELETE actions, test whether they had their intended effect, and then roll back the test changes to

Re: [GENERAL] ROLLBACK in a function

2010-05-23 Thread Craig Ringer
On 24/05/10 02:51, Ken Winter wrote: How can I write a PL/PgSQL function that rolls back every database change it has done? Have it raise an exception, causing the surrounding transaction to terminate with an error. Another function calling yours can still catch the exception and handle

[GENERAL] Rollback for aborted function?

2003-07-03 Thread Rory Campbell-Lange
If a function generates an exception, do I need to rollback manually? -- Rory Campbell-Lange [EMAIL PROTECTED] www.campbell-lange.net ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster