Re: UPDATE Trigger on multiple tables

From: Muralidharan Ramakrishnan <contact2muraliin(at)yahoo(dot)co(dot)in>
To: fmiddleton(at)verizon(dot)net, pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE Trigger on multiple tables
Date: 2005-10-13 13:22:17
Message-ID: 20051013132217.9431.qmail@web8601.mail.in.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

CREATE TRIGGER associates trigger function on a table and it is not possible to give more than one table seperated by comas.

CREATE TRIGGER emp_cust_stamp BEFORE INSERT OR UPDATE ON customers
FOR EACH ROW EXECUTE PROCEDURE last_updated_stamp();

CREATE TRIGGER emp_cust_stamp BEFORE INSERT OR UPDATE ON employees
FOR EACH ROW EXECUTE PROCEDURE last_updated_stamp();

Regards,
R.Muralidharan

Ferindo Middleton Jr <fmiddleton(at)verizon(dot)net> wrote:
Is it possible to have a single trigger on multiple tables
simultaneously? Example:

CREATE TRIGGER emp_cust_stamp BEFORE INSERT OR UPDATE ON employees, customers
FOR EACH ROW EXECUTE PROCEDURE last_updated_stamp();

I tried something like the above but get an error message at the comma. I tried using the keyword AND as well.
I couldn't find anything on this in the docs. I have many different tables in my databases which all have a
"last_updated" field and it seems less tedious to be able to enforce updating this trigger database-wide using
just one trigger. Is it possible?

Ferindo

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


---------------------------------
Yahoo! India Matrimony: Find your partner now.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2005-10-13 14:11:43 Re: pg, mysql comparison with "group by" clause
Previous Message Daryl Richter 2005-10-13 13:04:04 Re: SEVEN cross joins?!?!?