-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 > I was thinking thinking about the issue asked here, about an error in > a query causing the whole transaction to abort, ... > I wonder if the suggestion I ("leonbloy") gave, of adding a SAVEPOINT > after each insert (when doing interactive work) > is reasonable. Not only reasonable, but already implemented inside of psql. Just type: \set ON_ERROR_ROLLBACK on inside your psql session, and it will automatically create a savepoint before each command, and thus allow your transaction to continue even if you encounter errors. > "If you savepoint every single insert, you'll wind up begin much > much slower..." > > Does that also apply when I issue a SAVEPOINT with the same name? Does > the new savepoint release the previous and create a new > one, or does it "move" the previous? Or it's just that a new one is > created and the name "shadows" the previous, so that there are still N > active savepoints in the transaction, taking up memory/resources ? Yes, savepoints will slow things down, but probably not as much as you are fearing. Savepoints will nest (or shadow). The ON_ERROR_ROLLBACK feature creates the savepoint before the query, then either does a ROLLBACK TO or a RELEASE depending on the success of the query, so there is no build up of savepoints. - -- Greg Sabino Mullane greg@xxxxxxxxxxxx End Point Corporation http://www.endpoint.com/ PGP Key: 0x14964AC8 201004301245 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iEYEAREDAAYFAkvbCVIACgkQvJuQZxSWSsi4nwCdH8xwQ3RpVlD65I239hs/eAbW V3oAniaEv2VWFkrrhqDU9HDlCRMv1ROx =i0P6 -----END PGP SIGNATURE----- -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general