Skip site navigation (1) Skip section navigation (2)

Re: pgsql functions and transactions?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Betsy Barker <betsy(dot)barker(at)supportservicesinc(dot)com>,pgsql-novice(at)postgresql(dot)org
Subject: Re: pgsql functions and transactions?
Date: 2004-08-27 04:46:01
Message-ID: 200408262146.01453.josh@agliodbs.com (view raw or flat)
Thread:
Lists: 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

In response to

pgsql-novice by date

Next:From: Noel FauxDate: 2004-08-27 08:31:15
Subject: Re: Foreign keys
Previous:From: Tom LaneDate: 2004-08-27 03:09:12
Subject: Re: pgsql functions and transactions?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group