Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id C6A579FB324 for ; Mon, 18 Jun 2007 09:47:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 78708-10 for ; Mon, 18 Jun 2007 09:47:29 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from hu-out-0506.google.com (hu-out-0506.google.com [72.14.214.239]) by postgresql.org (Postfix) with ESMTP id 18F8B9FB272 for ; Mon, 18 Jun 2007 09:47:33 -0300 (ADT) Received: by hu-out-0506.google.com with SMTP id 22so743027hug for ; Mon, 18 Jun 2007 05:47:32 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=sJUC34IsTGvoXjC1hfhSkLKU3sd8oV/nUavXUJ3ZanX3Ih/276w7liKCMeplobIw13W24HfAAWN2h43DfRnArCbRUUhvK8dUzEVcUykiMiE7vKtzwb7psU7KRRBDvKJCKvKwEx4x29UYIelfRTlf9Cj1AONmrpBOpp/sjbM+URk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=phBOCE59FRbMQxuGPGmcnYizKumX2aRRAg4PTOhoUrjr+ArrKpCC03f75+wcui0pqvv1eGBULaMyB1cae479fRW3Y4USZKl2z7Jr7ta5+UyKi0WRd/2KuFVMzdWb5lljbPd00i66hqND0GY8rIFkms63GYCVsz4JPuFhtrs8o8A= Received: by 10.78.146.11 with SMTP id t11mr2275717hud.1182170851753; Mon, 18 Jun 2007 05:47:31 -0700 (PDT) Received: from ?192.168.0.199? ( [80.222.48.97]) by mx.google.com with ESMTP id k9sm899470nfh.2007.06.18.05.47.29 (version=SSLv3 cipher=RC4-MD5); Mon, 18 Jun 2007 05:47:30 -0700 (PDT) Message-ID: <46767EC3.3020505@enterprisedb.com> Date: Mon, 18 Jun 2007 13:46:59 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Christopher Hunt CC: pgsql-jdbc@postgresql.org Subject: Re: Literal vs parameterized 'timestamp with time zone' value References: <094DD6D8-B500-479F-B730-0BFCC256A5DE@internode.on.net> In-Reply-To: <094DD6D8-B500-479F-B730-0BFCC256A5DE@internode.on.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/56 X-Sequence-Number: 17118 Christopher Hunt wrote: > However if I use a parameter: > > PreparedStatement sqlStatement = > sqlConnection.prepareStatement("select validtime from > moving_object_status where validtime < ?"); > int columnIndex = 1; > sqlStatement.setString(columnIndex++, "2005-06-08T20:05:45.825+0"); > > No rows are returned. > > Can anyone explain the difference in results given a literal value and a > parameterised value in this context? I don't really have an explanation, but I would recommend using setTimestamp instead of setString for timestamp values. Maybe there's a time or timezone difference between client and server, and in the former case the server setting is used, and in the latter, the client setting? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com