transactions surrounding extension functions - Mailing list pgsql-sql

From Forest Wilkinson
Subject transactions surrounding extension functions
Date
Msg-id ts27ts498olm1t3btnddev9kss00etofn5@4ax.com
Whole thread Raw
Responses Re: transactions surrounding extension functions  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-sql
According to the postgres 7 docs:

>By default, Postgres executes transactions in unchained mode (also 
>known as “autocommit” in other database systems). In other words, each 
>user statement is executed in its own transaction and a commit is 
>implicitly performed at the end of the statement (if execution was 
>successful, otherwise a rollback is done). 

Does this mean that when I call a function I wrote, which is composed of
several queries, each of those queries will be executed in its own
transaction?  Or, will the statement containing the function call be
executed in its own transaction, thereby including all the queries
composing my function in that same transaction?

This is important when I have a function that performs a SELECT...FOR
UPDATE, followed by an UPDATE to the selected rows.  If I call that
function without surrounding it with BEGIN and END, the former behavior
would be dangerous, while the latter behavior would be desirable.

Thanks,

Forest Wilkinson



pgsql-sql by date:

Previous
From: John Hasler
Date:
Subject: Re: memory usage
Next
From: Peter Eisentraut
Date:
Subject: Re: transactions surrounding extension functions