Re: strange commit behavior
| От | Thomas Kellerer |
|---|---|
| Тема | Re: strange commit behavior |
| Дата | |
| Msg-id | gfu26d$eq5$1@ger.gmane.org обсуждение исходный текст |
| Ответ на | strange commit behavior ("Flavio Palumbo" <f.palumbo@silmasoftware.com>) |
| Список | pgsql-general |
Flavio Palumbo, 18.11.2008 10:01:
> I tested this tool under MySql and Oracle and everything went as expected.
>
> Unfortunately postgres seems to work in a different way, cause if there is
> just one error while the transaction is active I'm not able to commit the
> well formed data in the db, no matter if the good records were inserted
> sooner or later the error.
>
> Does this behavior appears right for postgres ?
Yes this is the way Postgres works (been there as well)
> There is any way or workaround to achieve my goal ?
You need to wrap each UPDATE/INSERT statement with a Savepoint
Savepoint sp = connection.setSavepoint()
try
{
// do your insert/update/delete here
connection.release(sp);
}
catch (SQLException sql)
{
connection.rollback(sp);
}
Thomas
В списке pgsql-general по дате отправления: