Re: A little help with transactions, please

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: ralough(at)iee(dot)org
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: A little help with transactions, please
Date: 2003-12-10 19:36:13
Message-ID: 20031210193613.GB18047@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Dec 03, 2003 at 12:16:44 +0000,
Richard Lough <ralough(dot)ced(at)dnet(dot)co(dot)uk> wrote:
> Hi all,
>
> This is my first attempt at transactions, and I seem to be missing
> something. Briefly, the transaction is this
>
> BEGIN;
> UPDATE table A;
> UPDATE table B;
> COMMIT;
>
> I find that the update to table A attempts to produce a duplicate
> primary primary key, and synchronisation with the server is lost.
>
> The update to table B then proceeds without the benefit of the
> option to rollback the transaction. This seems wrong to me.
> I need both updates completed or neither. Have I missed
> something?

I don't think it is normal for failed update statements to cause loss
of synchronization with the server. That can happen with copy statements
(though I think the new protocol available with 7.4 prevents this).
The second update statement should fail since you will be in an aborted
transaction. (Currently there isn't a way for an application to handle
errors and allow the transaction to continue after a failure.)

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bret Busby 2003-12-10 19:43:31 Re: [NOVICE] PostgreSQL Training
Previous Message Bruno Wolff III 2003-12-10 19:31:34 Re: relationship/table design question