Transaction Handling in pl/pgsql? - Mailing list pgsql-general

From Nee.mem(倪明)
Subject Transaction Handling in pl/pgsql?
Date
Msg-id ATLAS-MAILd9Ee4zadT000001ac@atlas-mail.atlas-mail.com
Whole thread Raw
Responses Re: Transaction Handling in pl/pgsql?
List pgsql-general
pgsql-general,
    

   On 7/12/05, Craig Bryden <postgresql ( at ) bryden ( dot ) co ( dot ) za> wrote:
> Hi
> 
> I am trying to get a better understanding of how transactions work in
> pl/pgsql functions. I found the following text in the help:
> "It is important not to confuse the use of BEGIN/END for grouping statements
> in PL/pgSQL with the database commands for transaction control. PL/pgSQL's
> BEGIN/END are only for grouping; they do not start or end a transaction"
> but I am still a bit confused.
> 
> Suppose I have a function that will be called from an application. Will all
> the statements in the function be rolled back if the last one generates an
> exception? or do I need to add code to a function to make that happen?
> 
> 

>suppose you have: select your_function(); 

>your_function adds some rows but the last one gives an error, because
>all statements that are out of a transaction block are in its own
>transaction the select calling your_function is inside a
>transaction... so, the answer is yes... the statements inside the
>function will be rolled back



How to use rollback  work in pl/pgsql functions.? Give an example 


pgsql-general by date:

Previous
From: "Nee.mem(倪明)"
Date:
Subject: How to use rollback in function with 'pgsql'?
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Transaction Handling in pl/pgsql?