X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE4D656587 for ; Thu, 10 Mar 2005 20:09:43 +0000 (GMT) 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 44768-05 for ; Thu, 10 Mar 2005 20:09:42 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.205]) by svr1.postgresql.org (Postfix) with ESMTP id 6D0CB564DA for ; Thu, 10 Mar 2005 20:09:41 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id a41so618308rng for ; Thu, 10 Mar 2005 12:09:42 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=QOUdnphrsv5rgwmmRfrLCORfa8CnBLhLGyBFkKcGhfWl0CIx7OpBGPgR2LeASiLk7Mr3699DUqd1B/GNcsqdrJDh6aNbe5NPrgDlatO+9guFWYJ7fvFZX3FcTudUfRF1Y0VRlft62MCIB8fCLy4bjIIIG7NGsCFZ63tzgX75HWA= Received: by 10.38.81.38 with SMTP id e38mr2075348rnb; Thu, 10 Mar 2005 12:09:42 -0800 (PST) Received: by 10.38.149.34 with HTTP; Thu, 10 Mar 2005 12:09:42 -0800 (PST) Message-ID: <2bffcc3305031012092fde7dc2@mail.gmail.com> Date: Thu, 10 Mar 2005 15:09:42 -0500 From: Henry Ortega Reply-To: Henry Ortega To: pgsql-sql@postgresql.org Subject: best way to auto-update a field when row is updated Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200503/156 X-Sequence-Number: 20635 I have the following table FIELD_A | FIELD_B | TSTAMP -------------------------------------------------------------------------------------------------------- x y 2005-03-10 14:56:47.456431 TSTAMP = not null default now() What's the best way to always auto-update TSTAMP to it's default value whenever the row gets updated? (e.g. update TABLENAME set FIELD_A='zzz' where FIELD_A='x'; should automatically set TSTAMP to now)