X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D1BBD9DC80E for ; Mon, 20 Mar 2006 19:03:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11099-01 for ; Mon, 20 Mar 2006 19:03:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by postgresql.org (Postfix) with ESMTP id 2BDB49DCC84 for ; Mon, 20 Mar 2006 19:03:35 -0400 (AST) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id D0A3A2397B7; Mon, 20 Mar 2006 18:03:37 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 29323-01-6; Mon, 20 Mar 2006 18:03:36 -0500 (EST) Received: from [42.65.238.42] (U40.N129.QueensU.CA [130.15.129.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id CC11B2397B4; Mon, 20 Mar 2006 18:03:35 -0500 (EST) Message-ID: <441F351E.8030203@samurai.com> Date: Mon, 20 Mar 2006 18:05:02 -0500 From: Neil Conway User-Agent: Thunderbird 1.5 (Macintosh/20051201) MIME-Version: 1.0 To: Bruce Momjian CC: Brendan Jurd , pgsql-patches@postgresql.org Subject: Re: Additional current timestamp values References: <200603202234.k2KMYOM04077@candle.pha.pa.us> In-Reply-To: <200603202234.k2KMYOM04077@candle.pha.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.452 required=5 tests=[AWL=0.120, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.452 X-Spam-Level: * X-Archive-Number: 200603/215 X-Sequence-Number: 19219 Bruce Momjian wrote: > CURRENT_TIMESTAMP might not be the > transaction start time on other database systems. > For this reason, and for completeness, > transaction_timestamp is provided. Well, transaction_timestamp() is even more unlikely to be the transaction start time on other database systems :) If the user wants non-standard syntax for getting the timestamp at which the current transaction began, we already have now(). > One trick is that these should be the same: > > test=> SELECT statement_timestamp(), transaction_timestamp(); Should they be? It seems quite reasonable to me that the DBMS begins a transaction internally (setting transaction_timestamp()), and then a short while later begins executing the statement submitted by the user, at which point statement_timestamp() is set. Perhaps ensuring they are identical for single-statement transactions is the best behavior, I just don't think this is required behavior. > And these should be the same: > > $ psql -c ' > INSERT INTO t VALUES (statement_timestamp()); > INSERT INTO t VALUES (statement_timestamp());' test > INSERT 0 1 Uh, why should these be the same? -Neil