pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: Nicholas E. Wakefield <nwakefield@KineticNetworks.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Unexpected Statement Caching with CURRENT_TIMESTAMP
Date: Fri, 11 Aug 2006 10:29:54 +0200
Message-ID: <44DC4002.60208@logix-tt.com> (raw)
In-Reply-To: <2F2A7EB72EBAF24582513E72ACCBCAAE17D8C9@kniexch01.KineticNetworks.com>
References: <2F2A7EB72EBAF24582513E72ACCBCAAE17D8C9@kniexch01.KineticNetworks.com>

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



view thread (3+ messages)

Message-ID: <44DC4002.60208@logix-tt.com>
Permalink:  ../44DC4002.60208@logix-tt.com/
Also on:    postgresql.org/message-id/44DC4002.60208@logix-tt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: schabi@logix-tt.com, nwakefield@KineticNetworks.com
  Subject: Re: Unexpected Statement Caching with CURRENT_TIMESTAMP
  In-Reply-To: <44DC4002.60208@logix-tt.com>
  References: <2F2A7EB72EBAF24582513E72ACCBCAAE17D8C9@kniexch01.KineticNetworks.com> <44DC4002.60208@logix-tt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox