pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@gmail.com>
To: Kaleeswaran Velu <v_kalees@yahoo.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Postgres trigger issue with update statement in it.
Date: Thu, 04 Apr 2013 06:16:35 -0700
Message-ID: <515D7D33.6080802@gmail.com> (raw)
In-Reply-To: <1365048506.78628.YahooMailNeo@web163902.mail.gq1.yahoo.com>
References: <1365048506.78628.YahooMailNeo@web163902.mail.gq1.yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On 04/03/2013 09:08 PM, Kaleeswaran Velu wrote:
>
> Hello Friends,
> I am new to Postgres DB. Recently installed Postgres 9.2.
> Facing an issue 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 record in table B, getting an
> error as below :
>
> ********** Error **********
> ERROR: cannot begin/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 this? Your help is appreciated.

Without seeing the actual code it is a guess, but here it goes.

 From this:

ERROR: cannot begin/end transactions in PL/pgSQL

I would say you tried to create a transaction in the function. Could be 
you wrote BEGIN; instead of BEGIN ... END;

>
> Thanks and Regards
> Kaleeswaran Velu


-- 
Adrian Klaver
adrian.klaver@gmail.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)  latest in thread

Message-ID: <515D7D33.6080802@gmail.com>
Permalink:  ../515D7D33.6080802@gmail.com/
Also on:    postgresql.org/message-id/515D7D33.6080802@gmail.com

 · 

reply

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-sql@postgresql.org
  Cc: adrian.klaver@gmail.com, v_kalees@yahoo.com
  Subject: Re: Postgres trigger issue with update statement in it.
  In-Reply-To: <515D7D33.6080802@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