Re: pgsql functions and transactions? - Mailing list pgsql-novice

From Josh Berkus
Subject Re: pgsql functions and transactions?
Date
Msg-id 200408262146.01453.josh@agliodbs.com
Whole thread Raw
In response to pgsql functions and transactions?  (Betsy Barker <betsy.barker@supportservicesinc.com>)
List pgsql-novice
Betsy,

> I read the posts on pgsql functions and transactions from the Novice list,
> and I think they are saying "PGSQL functions do not support transactions".
> Is this correct? Or is the idea that functions are automatically in a
> transaction?

That's right.   Soon (8.0 or 8.1) functions will support *sub-transactions*,
or savepoints, but that still won't do a checkpoint and synch, which is what
you need.

In my experience, there is a limit to the amount of processing you can
reasonably do in a single function in Postgres because of the need to stop
and synch (and possibly VACUUM).    I often have "series" of functions (in
one case, about 18) which are executed in succession by a Perl script.

We've been discussing PROCEDURES on -hackers which are non-transactional (and
thus can contain several transactions).  But nobody is coding this yet.

--
Josh Berkus
Aglio Database Solutions
San Francisco

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql functions and transactions?
Next
From: Steve Tucknott
Date:
Subject: Foreign keys