BUG #5996: CURRENT_TIMESTAMP uses often undesired TRANSACTION_TIMESTAMP, instead of STATEMENT_TIMESTAMP

From: "Brian S(dot) Krug" <bkrug(at)usatech(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5996: CURRENT_TIMESTAMP uses often undesired TRANSACTION_TIMESTAMP, instead of STATEMENT_TIMESTAMP
Date: 2011-04-28 19:33:13
Message-ID: 201104281933.p3SJXD1V044515@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5996
Logged by: Brian S. Krug
Email address: bkrug(at)usatech(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2011-04-29 05:34:35 Re: BUG #5996: CURRENT_TIMESTAMP uses often undesired TRANSACTION_TIMESTAMP, instead of STATEMENT_TIMESTAMP
Previous Message Kevin Grittner 2011-04-28 14:37:59 Re: BUG #5995: connection pooling not working