X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 57867D8364 for ; Thu, 13 Oct 2005 10:22:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93850-05 for ; Thu, 13 Oct 2005 13:22:14 +0000 (GMT) Received: from web8601.mail.in.yahoo.com (web8601.mail.in.yahoo.com [202.43.219.76]) by svr1.postgresql.org (Postfix) with SMTP id B8E1BD819F for ; Thu, 13 Oct 2005 10:22:15 -0300 (ADT) Received: (qmail 9433 invoked by uid 60001); 13 Oct 2005 13:22:17 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=jUWHLLYW9SxVBuqC6oxqfiUDisd5IJKGyc0k5MVm7+0WYdKB04ECqiRSmefgx3vYk1zwgQrbVuFwnvcEJG93PeCq54Q7ixzF6eh0iljDtk1dXLdKP9KzqO4WKGwBdOuJyfSXizDyFAoHkkbJJV+kpnf70c87NW2hojkzvatlXBw= ; Message-ID: <20051013132217.9431.qmail@web8601.mail.in.yahoo.com> Received: from [12.109.150.2] by web8601.mail.in.yahoo.com via HTTP; Thu, 13 Oct 2005 14:22:17 BST Date: Thu, 13 Oct 2005 14:22:17 +0100 (BST) From: Muralidharan Ramakrishnan Subject: Re: UPDATE Trigger on multiple tables To: fmiddleton@verizon.net, pgsql-sql@postgresql.org In-Reply-To: <434DE296.8060203@verizon.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-512963344-1129209737=:9407" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.565 required=5 tests=[AWL=-0.690, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, HTML_20_30=0.504, HTML_MESSAGE=0.001] X-Spam-Level: * X-Archive-Number: 200510/135 X-Sequence-Number: 22988 --0-512963344-1129209737=:9407 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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 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. --0-512963344-1129209737=:9407 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
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. --0-512963344-1129209737=:9407--