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 2F6419DD06E for ; Mon, 20 Mar 2006 19:19:26 -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 12789-01 for ; Mon, 20 Mar 2006 19:19:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 4B4209DCE49 for ; Mon, 20 Mar 2006 19:19:21 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k2KNJNs10543; Mon, 20 Mar 2006 18:19:23 -0500 (EST) From: Bruce Momjian Message-Id: <200603202319.k2KNJNs10543@candle.pha.pa.us> Subject: Re: Additional current timestamp values In-Reply-To: <441F3729.5060109@samurai.com> To: Neil Conway Date: Mon, 20 Mar 2006 18:19:23 -0500 (EST) CC: Peter Eisentraut , pgsql-patches@postgresql.org, Brendan Jurd X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.462 required=5 tests=[AWL=-0.038, RAZOR2_CHECK=0.5] X-Spam-Score: 0.462 X-Spam-Level: X-Archive-Number: 200603/219 X-Sequence-Number: 19223 Neil Conway wrote: > Bruce Momjian wrote: > > Peter Eisentraut wrote: > >> The most common complaint that I recall is that current_timestamp > >> returns the transaction timestamp rather than the statement timestamp, > >> which is what many expect. How does your patch address that? > > > > No, we believe the standard requires it. > > My copy of SQL 200n has the following to say: > > Annex C, paragraph 16: > > "The time of evaluation of the CURRENT_DATE, CURRENT_TIME, and > CURRENT_TIMESTAMP functions during the execution of an > SQL-statement is implementation-dependent." > > 6.31, : > > (1) The s CURRENT_DATE, CURRENT_TIME, > and CURRENT_TIMESTAMP respectively return the current date, > current time, and current timestamp; the time and timestamp values > are returned with time zone displacement equal to the current > default time zone displacement of the SQL-session. [...] > > (2) Let S be an that is not generally > contained in a . All s > that are contained in s that are generally > contained, without an intervening whose subject > routines do not include an SQL function, either in S without an > intervening or in an statement> contained in the of a trigger > activated as a consequence of executing S, are effectively evaluated > simultaneously. The time of evaluation of a function> during the execution of S and its activated triggers is > implementation-dependent. OK, so we just decided transaction timestamp is the most logical value for CURRENT_TIMESTAMP. Anyway, this might mean we should have transaction_timestamp for completeness. Not sure. -- Bruce Momjian http://candle.pha.pa.us SRA OSS, Inc. http://www.sraoss.com + If your life is a hard drive, Christ can be your backup. +