Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVMbS-0000O6-GG for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Apr 2013 13:52:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UVMbR-0001ij-St for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Apr 2013 13:52:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVMbR-0001id-1W for pgsql-bugs@postgresql.org; Thu, 25 Apr 2013 13:52:49 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVMbK-0007Js-Fr for pgsql-bugs@postgresql.org; Thu, 25 Apr 2013 13:52:48 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UVMbJ-0002x6-Dc for pgsql-bugs@postgresql.org; Thu, 25 Apr 2013 13:52:41 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1UVMbE-0003cv-7V for pgsql-bugs@postgresql.org; Thu, 25 Apr 2013 13:52:36 +0000 Date: Thu, 25 Apr 2013 13:52:36 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #8116: create trigger after insert fails if procedure being executed is having error To: pgsql-bugs@postgresql.org From: nitinmn@gmail.com X-Pg-Spam-Score: -1.0 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 8116 Logged by: CREATE TRIGGER AFTER INSERT FAILS Email address: nitinmn@gmail.com PostgreSQL version: 9.1.7 Operating system: WINDOWS , UNIX Description:=20=20=20=20=20=20=20=20 when we create a trigger for a table which basically runs triggers a procedure after insert.now if the procedure has some error when executing , the insert also fails, But ideally since this trigger is defined after insert , the insert should have been successful. eg CREATE OR REPLACE FUNCTION insert_send_mail_function() RETURNS "trigger" AS $BODY$ use Mail::Sendmail; $str =3D substr trim($_TD->{new}{url}),3; $subject =3D "Login Alert : ".$_TD->{new}{username}.", "; message =3D "URL accessed: ".$_TD->{new}{url}."\n"; %mail =3D ( From =3D> $_[0], To =3D> $_[1], Subject =3D> $subject , Message= =3D> $message); sendmail(%mail) or die $Mail::Sendmail::error; return undef; $BODY$ LANGUAGE 'plperlu' VOLATILE; CREATE TRIGGER insert_send_mail_trigger AFTER INSERT ON user_log FOR EACH ROW EXECUTE PROCEDURE insert_send_mail_function('abc@gmail.com', 'ab1213@gmail.com'); because there is a trim function , thought the procedure gets parsed successfully , while runtime it fails , but that should not stop insert failure since it is only after insert. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs