transactions surrounding extension functions

From: Forest Wilkinson <fspam(at)home(dot)com>
To: pgsql-sql(at)hub(dot)org
Subject: transactions surrounding extension functions
Date: 2000-09-28 18:30:20
Message-ID: ts27ts498olm1t3btnddev9kss00etofn5@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2000-09-28 19:04:27 Re: transactions surrounding extension functions
Previous Message John Hasler 2000-09-28 15:00:19 Re: memory usage