Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7F0EF9FA2E8 for ; Fri, 19 Oct 2007 15:05:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 24964-04-5 for ; Fri, 19 Oct 2007 15:05:39 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by postgresql.org (Postfix) with ESMTP id 6633A9FBC29 for ; Fri, 19 Oct 2007 15:05:38 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id j3so642995ugf for ; Fri, 19 Oct 2007 11:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=WrR1XP9+Z0EraqRC+5vDMuFD0biAkV5mhdp1Q+ggOwQ=; b=Iu1dz2+Ro7OZEFcvGrlNJVRpFxV8PaxummtCLBZDMA8Fy+iysa15envpBzLV8UKOy/+wy3KYAxDWNmbCU6g96jdGCg+LfBhGkztXu614EZ1gUiE8XxWcmnYwoK902jLAg+Q+mgh8eNmgZmNTsq8NQESxGJlpGjSj5d70TZmHe/8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LoXIjRjypq1hBnxGaXtuQ+wlTg97D468mqEPDiR7vZz5MyJc+I1dea1QPz+hFLPswG2xb+LaEejuQ56Eo/hfEcm2G6LOe7WGWRIKGjB2qBja77n9PslTgz85U2Ov+FAFAsCn25v+avj6gG5sS7VRIQXjrMiiT36rubGKPwwBztY= Received: by 10.67.19.9 with SMTP id w9mr3291695ugi.1192817137044; Fri, 19 Oct 2007 11:05:37 -0700 (PDT) Received: by 10.67.29.6 with HTTP; Fri, 19 Oct 2007 11:05:37 -0700 (PDT) Message-ID: Date: Fri, 19 Oct 2007 13:05:37 -0500 From: "Scott Marlowe" To: yogesh Subject: Re: Trigger AFTER UPDATE OR INSERT Cc: pgsql-admin@postgresql.org In-Reply-To: <1192777762.618697.226800@e34g2000pro.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1192777762.618697.226800@e34g2000pro.googlegroups.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/195 X-Sequence-Number: 27109 On 10/19/07, yogesh 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.