X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id CA3819FB2F9 for ; Fri, 4 Aug 2006 14:36:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 29414-05 for ; Fri, 4 Aug 2006 17:36:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.224]) by postgresql.org (Postfix) with ESMTP id 5D84C9FA28E for ; Fri, 4 Aug 2006 14:36:44 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id t13so145106wxc for ; Fri, 04 Aug 2006 10:36:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=aKjS813tkuLan+wJOesoR6enRKmfpZwwPfnKrEmFvhZ/xsajjSzKac8zRS30RGi5YeCfmmiMCLOTqKJiDHtBJEIaUqoIT75A7vQwESDZT+1f64TW7AwJRiLfR+5+7iMh46/xeoZFXJC0jb+TXuL5SYeXBrCz8ti7oNEU6KyYFpg= Received: by 10.78.193.5 with SMTP id q5mr1640366huf; Fri, 04 Aug 2006 10:36:42 -0700 (PDT) Received: by 10.78.56.16 with HTTP; Fri, 4 Aug 2006 10:36:42 -0700 (PDT) Message-ID: <7c33d060608041036k59056658o5acd68df36d0bbb6@mail.gmail.com> Date: Sat, 5 Aug 2006 00:36:42 +0700 From: "David Garamond" To: "Tom Lane" Subject: Re: autoupdating mtime column Cc: pgsql-sql@postgresql.org In-Reply-To: <29505.1154707823@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_36846_12792181.1154713002818" References: <7c33d060608040516n799af906sf74e1c645a47caff@mail.gmail.com> <44D34242.6000901@archonet.com> <7c33d060608040811s6dcaa3abia137188076a76781@mail.gmail.com> <29505.1154707823@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.334 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_50_60, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/40 X-Sequence-Number: 25998 ------=_Part_36846_12792181.1154713002818 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/4/06, Tom Lane wrote: > > If you are really intent on having a way to suppress the mtime update > you could dedicate an additional field to the purpose, eg > > UPDATE t SET foo=..., bar=..., keepmtime = true ... > > and in the trigger something like > > if new.keepmtime then > new.keepmtime = false; > else > new.mtime = now(); > > As long as nothing else ever touches keepmtime this would work. > Personally I'm dubious that it's worth the trouble Yeah, it's too expensive an overhead just for the sake of a slightly shorter UPDATE statement. --- do you > have a real use-case for suppressing mtime updates? > Syncing tables between databases (a la "rsync --times"). Btw, I'm considering temporarily disabling the update_times() trigger when sync-ing. Thanks, -- dave ------=_Part_36846_12792181.1154713002818 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/4/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
If you are really intent on having a way to suppress the mtime update
you could dedicate an additional field to the purpose, eg

UPDATE t SET foo=..., bar=..., keepmtime = true ...

and in the trigger something like

        if new.keepmtime then
                new.keepmtime = false;
        else
                new.mtime = now();

As long as nothing else ever touches keepmtime this would work.
Personally I'm dubious that it's worth the trouble

Yeah, it's too expensive an overhead just for the sake of a slightly shorter UPDATE statement. 

--- do you
have a real use-case for suppressing mtime updates?

Syncing tables between databases (a la "rsync --times"). Btw, I'm considering temporarily disabling the update_times() trigger when sync-ing.

Thanks,
--
dave
------=_Part_36846_12792181.1154713002818--