X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 2214E9FB31D for ; Fri, 11 Aug 2006 05:29:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 56931-05 for ; Fri, 11 Aug 2006 05:29:41 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id EAAD09FB2C0 for ; Fri, 11 Aug 2006 05:29:41 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (80-219-241-140.dclient.hispeed.ch [80.219.241.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id D3E11656BB; Fri, 11 Aug 2006 10:31:39 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id D3E1E18148BC0; Fri, 11 Aug 2006 10:29:54 +0200 (CEST) Message-ID: <44DC4002.60208@logix-tt.com> Date: Fri, 11 Aug 2006 10:29:54 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Thunderbird 1.5.0.4 (X11/20060713) MIME-Version: 1.0 To: "Nicholas E. Wakefield" Cc: pgsql-jdbc@postgresql.org Subject: Re: Unexpected Statement Caching with CURRENT_TIMESTAMP References: <2F2A7EB72EBAF24582513E72ACCBCAAE17D8C9@kniexch01.KineticNetworks.com> In-Reply-To: <2F2A7EB72EBAF24582513E72ACCBCAAE17D8C9@kniexch01.KineticNetworks.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/64 X-Sequence-Number: 15591 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