Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id BA7781337999 for ; Thu, 28 Apr 2011 16:33:25 -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 51886-08 for ; Thu, 28 Apr 2011 19:33:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id A51131336FA7 for ; Thu, 28 Apr 2011 16:33:14 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p3SJXDiC044516 for ; Thu, 28 Apr 2011 19:33:13 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p3SJXD1V044515; Thu, 28 Apr 2011 19:33:13 GMT (envelope-from www) Date: Thu, 28 Apr 2011 19:33:13 GMT Message-Id: <201104281933.p3SJXD1V044515@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5996: CURRENT_TIMESTAMP uses often undesired TRANSACTION_TIMESTAMP, instead of STATEMENT_TIMESTAMP From: "Brian S. Krug" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201104/212 X-Sequence-Number: 30131 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.