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

Re: Solution for rolling back many transactions?

From: Lexington Luthor <Lexington(dot)Luthor(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Solution for rolling back many transactions?
Date: 2006-09-27 23:27:18
Message-ID: eff1cs$4q3$1@sea.gmane.org (view raw or flat)
Thread:
Lists: pgsql-general
Phillip Tornroth wrote:
> In case it's useful information, the test database is pretty small... 
> Maybe 15 or 20 megs. The unit tests are individually pretty small.. Less 
> than 100 inserts each, for sure... So there's not that much to 'roll 
> back'.. As far as using transactions to undo the state of the database, 
> let me know if that's possible.. All of our tests have their own 
> transaction boundaries that they're applying. I don't want to undo that, 
> but certainly if I could nest each test in a longer-running tx and then 
> roll it back.. that could work.
> 

I use savepoints for my test framework.

Within a single transaction create savepoints and run your tests. When 
you are done, simply rollback the entire transaction. Within your tests, 
you can commit or rollback individual savepoints.

http://www.postgresql.org/docs/current/static/sql-savepoint.html

Regards,
LL


In response to

pgsql-general by date

Next:From: MarshallDate: 2006-09-27 23:40:11
Subject: Re: cyclical redundancy checksum algorithm(s)?
Previous:From: David PortasDate: 2006-09-27 22:31:10
Subject: Re: cyclical redundancy checksum algorithm(s)?

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