From: Scott Marlowe <scott.marlowe@gmail.com>
To: yogesh <yogesh.arora.daffodil@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Trigger AFTER UPDATE OR INSERT
Date: Fri, 19 Oct 2007 13:05:37 -0500
Message-ID: <dcc563d10710191105k244a5fecsb59718f9be6a322f@mail.gmail.com> (raw)
In-Reply-To: <1192777762.618697.226800@e34g2000pro.googlegroups.com>
References: <1192777762.618697.226800@e34g2000pro.googlegroups.com>
On 10/19/07, yogesh <yogesh.arora.daffodil@gmail.com> wrote:
> Hello frnds,
> I have a trigger on a table with After UPDATE OR INSERT ..that insert
> a record in an another table..........If the Trigger Fire Correctly
> the row is inserted or updated in the database as the case is. But if
> it is not fire correctly then the table is also not updated on which
> the trigger is..............
>
> Is it the right .................? if yes......How to insert the
> record in the table if the trigger is failed.
Yes, it's right. Triggers are part of a transaction (or run their
own) so if the trigger fails, so does the transaction.
If you really need to have something insert rather or not the
transaction succeeds, you can either use savepoints so that you can
roll back to before the error then insert the row anyway, or use
dblink to connect to the db through another backend and commit your
data that way.
You might want to give more info on exactly what you're trying to do
so the folks on the list can make better informed recommendations.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott.marlowe@gmail.com, yogesh.arora.daffodil@gmail.com
Subject: Re: Trigger AFTER UPDATE OR INSERT
In-Reply-To: <dcc563d10710191105k244a5fecsb59718f9be6a322f@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox