Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNbTb-0001vB-63 for pgsql-sql@arkaria.postgresql.org; Thu, 04 Apr 2013 04:08:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UNbTa-0001dO-Ft for pgsql-sql@arkaria.postgresql.org; Thu, 04 Apr 2013 04:08:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNbTZ-0001dJ-Em for pgsql-sql@postgresql.org; Thu, 04 Apr 2013 04:08:37 +0000 Received: from nm6-vm6.bullet.mail.gq1.yahoo.com ([98.136.218.197]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UNbTQ-000211-TZ for pgsql-sql@postgresql.org; Thu, 04 Apr 2013 04:08:36 +0000 Received: from [98.137.12.60] by nm6.bullet.mail.gq1.yahoo.com with NNFMP; 04 Apr 2013 04:08:26 -0000 Received: from [98.137.12.233] by tm5.bullet.mail.gq1.yahoo.com with NNFMP; 04 Apr 2013 04:08:26 -0000 Received: from [127.0.0.1] by omp1041.mail.gq1.yahoo.com with NNFMP; 04 Apr 2013 04:08:26 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 357187.65706.bm@omp1041.mail.gq1.yahoo.com Received: (qmail 80173 invoked by uid 60001); 4 Apr 2013 04:08:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1365048506; bh=zHZb2lDepJaFFOir1Hddga/QWo+rHbSVkVBuGFDkgKA=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=PfHDIZA7FhwefHDiGPj/rr4xjijV/J09/xvalohhMqwmzJ9duFJZbQ91xFh4g7/H75gibQDuL/0rYCfSQ44Oh1FuWgkOCrijDeud7bspm9CagO372gNzLioIKKRSKfly9F7ihJJPdSNXxHZWseoFVISGfq/ECms+lJ1f74vSEXg= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=klDioyLooclF5Xj2LO0g5gvyZh+I0fn3BJfvbflyfUbauZ9Lf4kqgRhYP3vks6bdJzub25RbpHbhhwQ7LJQ3GoWjL+e+/+ZH5EXzafmcr9zPLvWrkjCZYFoysq3tTcwtNm/JzRgtvwvBnypVYyWD8VzBdOQtM1x5mU13HcWaVNo=; X-YMail-OSG: e2F.JuMVM1nsGRVMo6hP3h5oS6_3E_o3abc0DYvaAllKh7q IcAtP4XkeoGhdDLo94PjEj.4HXk9x4FsvEWskZ6zoKn6kSqfdtH1lqdBNfJw MwBGbJYLIdYAJHh2Q7cESk1GEFhTpjk9PB94.tQfI1svTnVUYErSlKktnpHI vk3kYycGhSwKPUp._UAlinhe8CAk_75Zi6VVbdDj7j.m88o1tmoVRlM.RgKL uuX9Nwt.eW7fuePw4rG0d9uOa52qiu8q7Gqu46c6PPZLZO2CT1WlWDPYIYAf BvyOertvbgZh0kaJHdvq_7Ds9CIVgQDbFOb0JYbj9JSOz0hdPDUc4IpIMWlH ha6OYYiWqvlBlx.hKaJq1JcrhURFS7qIfcLxBCGkox3ic0nN_eaYThTRy0BP wZ8NIj9jbO8JmGJ6qXvTI9BHt_yFiJ20Jqida7msfWOZgv3raaA9mTKNfvoE S3p_UXnClsFXcA4KfNMnJYu17T3Htm7YYb.vD1Y3GTu_ICVJuXuyzetkk3a0 - Received: from [223.191.217.38] by web163902.mail.gq1.yahoo.com via HTTP; Wed, 03 Apr 2013 21:08:26 PDT X-Rocket-MIMEInfo: 002.001, CgrCoEhlbGxvIEZyaWVuZHMsCkkgYW0gbmV3IHRvwqBQb3N0Z3Jlc8KgREIuIFJlY2VudGx5IGluc3RhbGxlZCBQb3N0Z3JlcyA5LjIuwqAKRmFjaW5nIGFuIGlzc3VlIHdpdGggdmVyeSBzaW1wbGUgdHJpZ2dlciwgdHJpZWQgdG8gcmVzb2x2ZSBteXNlbGYgYnkgcmVhZGluZyBkb2N1bWVudHMgb3IgZ29vZ2xlIHNlYXJjaCBidXQgbm8gbHVjay4KCkkgaGF2ZSBhIHRhYmxlIEEocGFyZW50KSBhbmQgdGFibGUgQiAoY2hpbGQpLiBUaGVyZSBpcyBhIEJFRk9SRSBJTlNFUlQgT1IgVVBEQVRFIHRyaWdnZXIgYXQBMAEBAQE- X-Mailer: YahooMailWebService/0.8.140.532 Message-ID: <1365048506.78628.YahooMailNeo@web163902.mail.gq1.yahoo.com> Date: Wed, 3 Apr 2013 21:08:26 -0700 (PDT) From: Kaleeswaran Velu Reply-To: Kaleeswaran Velu Subject: Postgres trigger issue with update statement in it. To: "pgsql-sql@postgresql.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="1584674120-311978546-1365048506=:78628" X-Pg-Spam-Score: -1.6 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org --1584674120-311978546-1365048506=:78628 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =0A=0A=A0Hello Friends,=0AI am new to=A0Postgres=A0DB. Recently installed P= ostgres 9.2.=A0=0AFacing an issue with very simple trigger, tried to resolv= e myself by reading documents or google search but no luck.=0A=0AI have a t= able A(parent) and table B (child). There is a BEFORE INSERT OR UPDATE trig= ger attached in table B. This trigger has a update statement in it. This up= date statement should update a respective record in table A when ever there= is any insert/update happen in table B. =A0The issue here is where ever I = insert/update record in table B, getting an error as below :=0A=0A*********= * Error **********=0AERROR: cannot begin/end transactions in PL/pgSQL=0ASQL= state: 0A000=0AHint: Use a BEGIN block with an EXCEPTION clause instead.= =0AContext: PL/pgSQL function func_update_payment() line 53 at SQL statemen= t=0A=0ALine no 53 in the above error message is an update statement. If I c= omment out the update statement, trigger works fine.=0A=0ACan anyone=A0shed= =A0some lights on this? Your help is appreciated.=0A=0AThanks and Regards= =0AKaleeswaran Velu --1584674120-311978546-1365048506=:78628 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable

 Hello Friends= ,
I am new to&nbs= p;Postgres DB= . Recently installed Postgres 9.2. 
Facing an i= ssue with very simple trigger, tried to resolve myself by reading documents= or google search but no luck.

I have a table A(parent) and table B (child). There is a BEFORE INSERT OR = UPDATE trigger attached in table B. This trigger has a update statement in = it. This update statement should update a respective record in table A when= ever there is any insert/update happen in table B.  The issue here is where ever I insert/update reco= rd in table B, getting an error as below :

********** Error *****= *****
ERROR: cannot begi= n/end transactions in PL/pgSQL
SQL state: 0A000
= Hint: Use a BEGIN block with an EXCEPTION clause instead.
Context: PL/pgSQL function func_update_= payment() line 53 at SQL statement

Line no = 53 in the above error message is an update statement. If I comment out the = update statement, trigger works fine.

Can anyone shed some lights on t= his? Your help is appreciated.
=
Thanks and Regards
Kale= eswaran Velu
--1584674120-311978546-1365048506=:78628--