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

Re: Generic/Common trigger

From: <mallah(at)trade-india(dot)com>
To: <josue(at)lamundial(dot)hn>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Generic/Common trigger
Date: 2004-08-30 16:37:54
Message-ID: 33409.203.122.31.2.1093883874.squirrel@mail.trade-india.com (view raw or flat)
Thread:
Lists: pgsql-general
Yes.

CREATE FUNCTION "last_updated" () RETURNS TRIGGER AS '
        BEGIN
                NEW.stamp = now();
                RETURN NEW;
        END;
' LANGUAGE 'plpgsql';


CREATE TRIGGER update_stamp AFTER UPDATE OR INSERT ON table FOR EACH ROW EXECUTE PROCEDURE
last_updated();
regds
mallah.


> Hello list,
>
> Is there a way to write a common/generic trigger function for multiple  tables to save in a
> column (stamp) the last time a row was inserted or  modified.
>
>
> --
> Sinceramente,
> Josué Maldonado.
>
> "Tiene la ciencia sus hipócritas, no menos que la virtud, y no menos es  engañado el vulgo por
> aquéllos que por éstos. Son muchos los indoctos  que pasan plaza de sabios." Jerónimo Feijoo.
> Escritor español.
>
> ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to
> increase your free space map settings
>
> !DSPAM:4133576a86001177520034!



-----------------------------------------
Over 1,00,000 exporters are waiting for your order! Click below to get
in touch with leading Indian exporters listed in the premier
trade directory Exporters Yellow Pages.
http://www.trade-india.com/dyn/gdh/eyp/



pgsql-general by date

Next:From: Thomas ChilleDate: 2004-08-30 19:20:14
Subject: aggregates with complex type as state and init condition
Previous:From: Josué MaldonadoDate: 2004-08-30 16:23:15
Subject: Generic/Common trigger

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