Skip site navigation (1) Skip section navigation (2)

Re: DML fails after updatable cursor is used with trigger returning function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dharmendra Goyal" <dharmendra(dot)goyal(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: DML fails after updatable cursor is used with trigger returning function
Date: 2007-10-31 22:36:55
Message-ID: 22169.1193870215@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"Dharmendra Goyal" <dharmendra(dot)goyal(at)gmail(dot)com> writes:
> I created one function which updates a table using updatable cursor. I wrote
> one trigger also on the same table. When i execute the function it gives
> expected results.  But after that all DMLs fail.

The problem is that your trigger function recursively invokes itself.

If you used an unbound cursor variable (so that the portal name gets
selected dynamically) you could avoid the conflict of cursor name
between inner and outer executions, but you'd still need to do something
about avoiding infinite recursion.  Also, closing a cursor when done
with it would be a real good idea.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2007-10-31 23:07:56
Subject: Re: psql show dbsize?
Previous:From: Tom LaneDate: 2007-10-31 22:11:57
Subject: Re: psql show dbsize?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group