pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
transactions surrounding extension functions
2+ messages / 2 participants
[nested] [flat]

* transactions surrounding extension functions
@ 2000-09-28 18:30  Forest Wilkinson <fspam@home.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Forest Wilkinson @ 2000-09-28 18:30 UTC (permalink / raw)
  To: pgsql-sql@hub.org

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: transactions surrounding extension functions
@ 2000-09-28 19:04  Peter Eisentraut <peter_e@gmx.net>
  parent: Forest Wilkinson <fspam@home.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2000-09-28 19:04 UTC (permalink / raw)
  To: Forest Wilkinson <fspam@home.com>; +Cc: pgsql-sql@hub.org

Forest Wilkinson writes:

> 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?

No

> 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?

Yes

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-09-28 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-28 18:30 transactions surrounding extension functions Forest Wilkinson <fspam@home.com>
2000-09-28 19:04 ` Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox