Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 510F91337BB7 for ; Fri, 29 Apr 2011 02:34:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 30677-10 for ; Fri, 29 Apr 2011 05:34:40 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hogranch.com (hogranch.com [75.101.82.47]) by mail.postgresql.org (Postfix) with ESMTP id E21A41337999 for ; Fri, 29 Apr 2011 02:34:39 -0300 (ADT) Received: from [127.0.0.1] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id p3T5YZE03984; Thu, 28 Apr 2011 22:34:35 -0700 Message-ID: <4DBA4DEB.8090305@hogranch.com> Date: Thu, 28 Apr 2011 22:34:35 -0700 From: John R Pierce User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org CC: bkrug@usatech.com Subject: Re: BUG #5996: CURRENT_TIMESTAMP uses often undesired TRANSACTION_TIMESTAMP, instead of STATEMENT_TIMESTAMP References: <201104281933.p3SJXD1V044515@wwwmaster.postgresql.org> In-Reply-To: <201104281933.p3SJXD1V044515@wwwmaster.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/213 X-Sequence-Number: 30132 On 04/28/11 12:33 PM, Brian S. Krug wrote: > The following bug has been logged online: > > Bug reference: 5996 > Logged by: Brian S. Krug > Email address: bkrug@usatech.com > PostgreSQL version: 9.0.3 > Operating system: Solaris > Description: CURRENT_TIMESTAMP uses often undesired > TRANSACTION_TIMESTAMP, instead of STATEMENT_TIMESTAMP > Details: > > CURRENT_TIMESTAMP (and CURRENT_DATE, CURRENT_TIME) return the time of the > start of the transcaction - which seems to be right after the end of the > last transaction. Thus, if you use pooled connections, CURRENT_TIMESTAMP > will return the time of the last COMMIT. This is often unintended behavior. > This tripped me up significant and I would anticipate that many have fallen > into the same trap. I recommend that CURRENT_TIMESTAMP functions as > STATEMENT_TIMESTAMP instead of as TRANSACTION_TIMESTAMP. > Transactions start when you issue a BEGIN; command. If you don't issue a BEGIN, then every statement is a self contained transaction. Are you using a runtime abstraction thats doing this automagically behind your back right after COMMIT; ? if so, thats your problem. old JDBC's did exactly that, and it caused other ugly problems like long running IDLE In Transaction processes.