X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4158A5E46E1 for ; Thu, 26 Aug 2004 02:16:15 -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 91869-08 for ; Thu, 26 Aug 2004 05:16:08 +0000 (GMT) Received: from mailbox10.ucsd.edu (mailbox10.ucsd.edu [132.239.1.62]) by svr1.postgresql.org (Postfix) with ESMTP id 1E9F65E46DC for ; Thu, 26 Aug 2004 02:16:08 -0300 (ADT) Received: from irpsmail.ucsd.edu (irpsmail.ucsd.edu [132.239.21.3]) by mailbox10.ucsd.edu (8.13.1/8.13.0.Alpha0) with ESMTP id i7Q5G6RC081913 for ; Wed, 25 Aug 2004 22:16:06 -0700 (PDT) Message-id: Date: Wed, 25 Aug 2004 22:16:04 -0700 Subject: Mod_date update technique To: pgsql-php@postgresql.org From: "Gary Hoffman" MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MailScanner: PASSED (v1.2.8 72816 i7Q5G6RC081913 mailbox10.ucsd.edu) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/39 X-Sequence-Number: 2927 I have a column named mod_date on a particular table. It has a default value of now() which is the create date of the row. However, I want to update that field with the current timestamp whenever its record is updated. I know how to do this using PHP by including the date() in the data I'm using to update the record. However, I would like to do this on the PostgreSQL side of the transaction. I can't figure out how to write a trigger or other technique to do this. Simply asked: What is the easiest way to automatically update the mod_date field when the record is updated? Gary ************************************************************************** * Gary B. Hoffman, Computing Services Manager e-mail: ghoffman@ucsd.edu * * Graduate School of International Relations and Pacific Studies (IR/PS) * * University of California, San Diego (UCSD) voice: (858) 534-1989 * * 9500 Gilman Dr. MC 0519 fax: (858) 534-3939 * * La Jolla, CA 92093-0519 USA web: http://irps.ucsd.edu/ * **************************************************************************