Cascading Trigger Prevention - Mailing list pgsql-general

From JonXP
Subject Cascading Trigger Prevention
Date
Msg-id 05d292fb-bbfa-4737-8280-37e883e43c92@a35g2000prf.googlegroups.com
Whole thread Raw
Responses Re: Cascading Trigger Prevention  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Hello All,

I have a table that contains a nested set (using paths), and I'm
trying to create a trigger that updates the timestamps of a node and
all of its parents on a modification.  Unfortunately, this is causing
infinitely recurring triggers.

The insert occurs, which fires the trigger, which then updates all of
the parent rows, which then fires the trigger again for each update,
which recurses yet again.

I have been looking with no success for a way to turn off triggers,
and am surprised that there is no method of preventing a trigger from
running when performing a query.  Even more bothersome is the fact
that a trigger has no way of knowing when it has been called by
another trigger.

I don't want to have to move my modified timestamps to a separate
table just so that the triggers don't recurse themselves, but this is
looking like it will be the case.

Does anyone have any thoughts or alternate suggestions?

pgsql-general by date:

Previous
From: "Sebastian - Anton PONOVESCU"
Date:
Subject: certificate based authorization
Next
From: "Willy-Bas Loos"
Date:
Subject: Re: 1 cluster on several servers