Re: strange commit behavior

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Flavio Palumbo *EXTERN*" <f(dot)palumbo(at)silmasoftware(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: strange commit behavior
Date: 2008-11-18 12:24:59
Message-ID: D960CB61B694CF459DCFB4B0128514C202C687AA@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Flavio Palumbo wrote:
> I developed a little tool in Java that updates databases throught text
> files.
>
> In this tool there is an option that allows the user accepts a defined
> amount of errors and save the well formed data.
>
> To do this I start commitment control when the process begins
> and, at the
> end, if the thershold is not reached or there are no errors I
> commit data,
> else rollback.
>
> 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 ?
>
> There is any way or workaround to achieve my goal ?

You use savepoints for this:
http://www.postgresql.org/docs/8.3/static/tutorial-transactions.html
http://www.postgresql.org/docs/current/static/sql-savepoint.html

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2008-11-18 12:28:42 Re: [GENERAL] db_user_namespace, md5 and changing passwords
Previous Message Sam Mason 2008-11-18 12:22:05 Re: citing postgresql