Re: Stored Procedure / Trigger Strangeness - Mailing list pgsql-general

From Darren Ferguson
Subject Re: Stored Procedure / Trigger Strangeness
Date
Msg-id Pine.LNX.4.10.10112211102210.17023-100000@thread.crystalballinc.com
Whole thread Raw
In response to Re: Stored Procedure / Trigger Strangeness  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
If you need them to go in a specific order why not call one trigger and
have it call other functions not triggers and then you would get the
desired result


Darren

Darren Ferguson
Software Engineer
Openband

On Fri, 21 Dec 2001, Tom Lane wrote:

> laotse@lumberjack.snurgle.org writes:
> > ------------------------------------------------------------------ CREATE
> > TRIGGER fti_employee_lastname AFTER UPDATE OR INSERT OR DELETE ON person
> > FOR EACH ROW EXECUTE PROCEDURE fti(fti, lastname);
>
> > CREATE TRIGGER fti_employee_firstname AFTER UPDATE OR INSERT OR DELETE ON
> > person FOR EACH ROW EXECUTE PROCEDURE fti(fti, firstname);
>
> > CREATE TRIGGER fti_employee_screenname AFTER UPDATE OR INSERT OR DELETE ON
> > person FOR EACH ROW EXECUTE PROCEDURE fti(fti, screenname);
>
> This will not work because there's no guarantee about the order of the
> execution of the triggers.  I haven't worked with fti much, but it's
> obvious that it expects you to have only *one* trigger relating a given
> indextable to the master --- on update, the trigger deletes all existing
> indextable rows for that master row.
>
> It looks like the intended way to index multiple columns using a single
> indextable is
>
> CREATE TRIGGER fti_person AFTER UPDATE OR INSERT OR DELETE ON person
> FOR EACH ROW EXECUTE PROCEDURE fti(fti, firstname, lastname, screenname);
>
> Or you could use a separate indextable for each column, but that might
> not be what you want.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


pgsql-general by date:

Previous
From: laotse@lumberjack.snurgle.org
Date:
Subject: Re: Stored Procedure / Trigger Strangeness
Next
From: Joe Koenig
Date:
Subject: Is the Windows Version Stable?