From: Muralidharan Ramakrishnan <contact2muraliin@yahoo.co.in>
To: fmiddleton@verizon.net
To: pgsql-sql@postgresql.org
Subject: Re: UPDATE Trigger on multiple tables
Date: Thu, 13 Oct 2005 14:22:17 +0100 (BST)
Message-ID: <20051013132217.9431.qmail@web8601.mail.in.yahoo.com> (raw)
In-Reply-To: <434DE296.8060203@verizon.net>
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@verizon.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: contact2muraliin@yahoo.co.in, fmiddleton@verizon.net
Subject: Re: UPDATE Trigger on multiple tables
In-Reply-To: <20051013132217.9431.qmail@web8601.mail.in.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox