Martin Marques <[EMAIL PROTECTED]> writes:
> Basically, I have 5 fields, one being a PK (SERIAL), 3 with information, and 
> the last one a timestamp field that will show the last time the register was 
> modified (tmodif which has a DEFAULT CURRENT_TIMESTAMP).

> Now, eveytime someone modifys any, or all of the 3 information fields,
> I want the tmodif field of that register to be set to now().

This is trivial to do with a trigger --- you just need something like

        NEW.lastmod := now();
        RETURN NEW;

There's a complete example at the bottom of this page:
http://developer.postgresql.org/docs/postgres/plpgsql-trigger.html

                        regards, tom lane

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

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to