On Mon, Dec 03, 2001 at 10:31:11AM -0800, Rob Messer wrote:
> Joern,
> 
> Perhaps more detail on your original example would be useful.  I know
> from working with Oracle that if you feed it an insert with a primary key
> violation in the middle of a transaction, it will abort the transaction
> and rollback, just like PostgreSQL.

I don't think that's correct.  I just wrote a quick test script, which
connects to an Oracle database with AutoCommit and RaiseError off and
PrintError on, inserts two rows with the same primary key into a table,
then calls commit.  An error is printed for the second insert; the first
insert is commited, not rolled back.


> As your original example was provided, it didn't really seem to
> be a PostgreSQL issue.  In your new example, if you put everything in an eval
> loop and have a commit after each insert then it should work ok:
> 
> eval {
>   insert...
>   commit
> };
> if ($@) {
>   check for type of error
>   do update if appropriate
> }

There wouldn't be much point in turning off AutoCommit if you had to commit
after every statement anyway, would there?

Ronald

Reply via email to