Re: Transactions, Triggers and Error Messages - Mailing list pgsql-general

From Tom Lane
Subject Re: Transactions, Triggers and Error Messages
Date
Msg-id 9566.1131489750@sss.pgh.pa.us
Whole thread Raw
In response to Transactions, Triggers and Error Messages  (Ledina Hido <lh1101@ecs.soton.ac.uk>)
List pgsql-general
Ledina Hido <lh1101@ecs.soton.ac.uk> writes:
> Now when I run the following (after inserting person with id=5 into
> pers table):

> begin;
> set constraints all deferred;
> insert into tasks (pid, task) values (5, 'firstTask');
> insert into tasks (pid, task) values (5, 'secondTask');
> insert into tasks (pid, task) values (5, 'thirdTask');
> insert into tasks (pid, task) values (5, 'forthTask');
> insert into tasks (pid, task) values (5, 'fifthTask');
> commit;

> the transaction is correctly aborted but the error message I get is
> not the one that raised the exception ie "3 tasks already exists for
> person with pid 5" but the one from trying to insert the fifth task
> (ie last statement) which is "ERROR:  current transaction is aborted,
> commands ignored until end of transaction block"

What are you running this in?  ISTM this is a problem with bad structure
of client-side code, not something to be fixed on the server side.

            regards, tom lane

pgsql-general by date:

Previous
From: Ledina Hido
Date:
Subject: Transactions, Triggers and Error Messages
Next
From: Ledina Hido
Date:
Subject: Re: Transactions, Triggers and Error Messages