X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A50EDD1C50E for ; Sun, 27 Jul 2003 07:47:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 94649-08 for ; Sun, 27 Jul 2003 04:46:28 -0300 (ADT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id 8BE95D1C4D7 for ; Sun, 27 Jul 2003 04:47:17 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 19ggFS-000990-0X; Sun, 27 Jul 2003 08:47:18 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 2131F16B6C; Sun, 27 Jul 2003 08:47:17 +0100 (BST) Received: from mainbox.archonet.com (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with SMTP id 7722615A64; Sun, 27 Jul 2003 08:47:16 +0100 (BST) Received: from 192.168.1.32 (SquirrelMail authenticated user dev) by mainbox.archonet.com with HTTP; Sun, 27 Jul 2003 08:47:16 +0100 (BST) Message-ID: <49182.192.168.1.32.1059292036.squirrel@mainbox.archonet.com> In-Reply-To: <20030727015832.D1636@natasha.ward.six> References: <20030726193947.B1636@natasha.ward.six> <200307261514.16322.dev@archonet.com> <20030727015832.D1636@natasha.ward.six> Date: Sun, 27 Jul 2003 08:47:16 +0100 (BST) Subject: Re: Very strange 'now' behaviour in nested triggers. From: "Richard Huxton" To: "Denis Zaitsev" Cc: "Richard Huxton" , pgsql-sql@postgresql.org User-Agent: SquirrelMail/1.4.0 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/400 X-Sequence-Number: 14514 > On Sat, Jul 26, 2003 at 03:14:16PM +0100, Richard Huxton wrote: >> On Saturday 26 July 2003 14:39, Denis Zaitsev wrote: > >> Solution: make the default now() or CURRENT_TIMESTAMP and all will be as >> you >> expect. >> >> PS - I think this is mentioned in the manuals somewhere, but it's not >> surprising you missed it. Interesting example. > > As I remember, namely 'now' is mentioned in the manuals, as the best > approach to keep the same value thru the whole transaction. That is > why I used it here. For now I've tested that now() does the thing. > Why? I remember that now() is changing thru the transaction, just > showing the current time... No- 'now',now() and CURRENT_TIMESTAMP all stay fixed during a transaction. The one that changes is timeofday() I think. See the "Functions and Operators" section for details. - Richard