Search Postgresql Archives

Re: Transactions, Triggers and Error Messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ledina Hido wrote:

Thinking about it, the EXCEPTION statement would be inside my user- defined function (where I raise the exception in the first place), so I cannot see how that would help. As far as I could understand, I cannot call "ROLLBACK" (which is what I want to do) inside a user defined function. I tried calling it and it was simply ignored. Or am I missing something here?

Yes - you want to read up on SAVEPOINTs to handle exceptions at the applicaton level. You do something like:

SAVEPOINT foo;
...command that works...
...command that works...
...oops, this one gives me an error...
ROLLBACK TO SAVEPOINT foo;

Exceptions in plpgsql are just a wrapper to this process.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux