Hi, Nicolas,
Nicholas E. Wakefield wrote:
> I'm executing 'SELECT CURRENT_TIMESTAMP' from a statement object with
> auto commit off and prepare threshold set to 1. I'm finding that the
> result comes back the same for after multiple calls and instantiations
> of the statement object(The same happens for a prepared statement).
> However this does not occur when I perform a commit before or after
> every call.
>
> Is this expected behaviour?
Yes, it's expected, intended and documented in the PostgreSQL docs:
http://www.postgresql.org/docs/8.1/static/functions-datetime.html
SELECT timeofday(); returns a clock that advances even during
transactions. As it returns a textual representation, you may need to
cast it to a timestamp in some query contexts, though:
select timeofday(); -- returns text
select timeofday()::timestamp; -- returns timestamp - postgresql variant
select CAST(timeofday() AS timestamp) ; -- returns timestamp in sql99
HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org