Re: Transactions, Triggers and Error Messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ledina Hido <lh1101(at)ecs(dot)soton(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Transactions, Triggers and Error Messages
Date: 2005-11-08 22:42:30
Message-ID: 9566.1131489750@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ledina Hido <lh1101(at)ecs(dot)soton(dot)ac(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ledina Hido 2005-11-08 23:03:50 Re: Transactions, Triggers and Error Messages
Previous Message Ledina Hido 2005-11-08 22:18:55 Transactions, Triggers and Error Messages