Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 8940B2E00A4 for ; Wed, 7 May 2008 10:23:36 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 23826-02-4 for ; Wed, 7 May 2008 10:23:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.238]) by developer.postgresql.org (Postfix) with ESMTP id 9571E2E00A2 for ; Wed, 7 May 2008 10:23:06 -0300 (ADT) Received: by rv-out-0506.google.com with SMTP id b25so483170rvf.43 for ; Wed, 07 May 2008 06:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=sIpx5hbUFjLfeGxtw/i5tygcYoGkvZGMXbWX3YdEIEE=; b=AjfvvmNu8KedoYgJFrF/L/N/LznI3f818vOe7GgfaEkCe9l0eie/MY1iuX2zamu/EZSUCv4z95d1FIu8+JxwryfSodlDHUpMBj+SZShPxv4Xzpv0wl7dE55ZyHqAvH3uBmKuG+/bbyWeBhUtfWgRBL9iqyROKAksKxapDuli9jk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qYYCsDeG+UhBXvYPtd9JAuhGwT+j9lKsRicZjNCAyJq0fcVeZj/ki5um5/3an9EixOvvE53qat0hW4tvGI78NN4cRFmVEEl4/WHuVm6TBisrbxhUCCHzoMAtQTuibocvr3fzTbioAFYxkGMpvQQ7VyeOF9zovheNGP882LG4TVI= Received: by 10.140.142.6 with SMTP id p6mr948180rvd.224.1210166584956; Wed, 07 May 2008 06:23:04 -0700 (PDT) Received: by 10.141.85.4 with HTTP; Wed, 7 May 2008 06:23:04 -0700 (PDT) Message-ID: <396486430805070623p360b8eafp39683a287cdb3cc@mail.gmail.com> Date: Wed, 7 May 2008 06:23:04 -0700 From: "Richard Broersma" To: "Michael Monnerie" Subject: Re: column: on update update? Cc: pgsql-admin@postgresql.org In-Reply-To: <200805071050.41450@zmi.at> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200805071050.41450@zmi.at> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/47 X-Sequence-Number: 29131 On Wed, May 7, 2008 at 1:50 AM, Michael Monnerie wrote: > But I also need the "lastupdate" be updated every time a field in that > row is updated, so a statement like this: > > But it doesn't work. Do I need a trigger? If yes, what would be the > format? I never did triggers. Well you have two options. The perferred method would be to have your application include an update to your lastupdate field whenever anyother rows are updated. UPDATE awl SET lastupdate = CURRENT_TIMESTAMP, ...., WHERE ....; the other option is to add an after update trigger, and manually set lastupdate then. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug