Home > Archive > PostgreSQL Discussion > August 2005 > An update rule affecting an after insert trigger









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author An update rule affecting an after insert trigger
Simrin Grewal

2005-08-27, 1:23 pm

Hey Folks,

Scratching my head on this one wanted to know if anyone else had
encounter it.

I have a table that has an update rule and an after insert trigger on
it. The rule checks to see if certain things happened during the update
and goes and does another insert to a secondary table. The trigger is
an after insert trigger to call a stored plpgsql function. The problem
I am seeing is that I cannot get the trigger to fire. I did a simple
test just to verify that triggers are working in general and they are
but nothing for this one. I have even intentionally broken the stored
procedure just to see if I was making it to that logic but nothing. Does
anyone know what might cause this to occur?

Simrin Grewal

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Michael Fuhr

2005-08-27, 8:23 pm

On Sat, Aug 27, 2005 at 11:08:26AM -0700, Simrin Grewal wrote:
> I have a table that has an update rule and an after insert trigger on
> it. The rule checks to see if certain things happened during the update
> and goes and does another insert to a secondary table. The trigger is
> an after insert trigger to call a stored plpgsql function. The problem
> I am seeing is that I cannot get the trigger to fire.


You say you have an *update* rule and an *insert* trigger on the
same table. Is that correct? Are you doing an INSERT when you
expect the trigger to be called?

It would be easier to help if we could see a complete but minimal
example that demonstates the problem. That is, the smallest possible
example that somebody could load into an empty database and see the
behavior you're seeing. Also, what version of PostgreSQL are you
using?

> I have even intentionally broken the stored procedure just to see if
> I was making it to that logic but nothing.


Adding RAISE statements with debugging messages might be preferable
to breaking the code.

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com