Re: loop on trigger

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: <mgermoni(at)uniautomation(dot)it>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: loop on trigger
Date: 2001-04-19 08:29:16
Message-ID: 20010419082916.498292A3AB@mainbox.archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

mgermoni(at)uniautomation(dot)it said:

> following your indication I found what I was looking for...Thank you.
>
> I made a simple trigger/function that:
> on insert check if a particular field is already on one table if not it
> will procede to make the insert otherwise not.
> But it goes on loop. Now just because I do not have experience, I'm
> wondering if it possible to do it without going in loop, because if the
> trigger is build up to get fired before the action and inside itself,
> actualy, there is again the continuos of the action it is called again
> and so on. There is a method to do without using the same table to
> do the control and then the action? In other words interception an
> insert to a specific table if the control is true to procede with the
> action itself without hitting any loop?
> TX

Had the same problem myself. I don't believe there is a way to "short-circuit"
the loop.

See if you can't replace the trigger with a view and a couple of rules. You'll
need one rule to handle the default case and a second to deal with the special
case.

If you need more information, could you please provide the details of your
tables and trigger.

HTH

- Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Toomas Gavrilin 2001-04-19 08:31:57 oid
Previous Message Ryan Mahoney 2001-04-19 08:25:12 query varchar fields by length