Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id B4DB99FB311 for ; Fri, 13 Apr 2007 17:25:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 65594-05 for ; Fri, 13 Apr 2007 17:25:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from beaver.fastcrypt.com (beaver.fastcrypt.com [64.7.141.17]) by postgresql.org (Postfix) with ESMTP id 1DC109FB2D9 for ; Fri, 13 Apr 2007 17:25:00 -0300 (ADT) Received: from [192.168.1.14] (dcdsl.ebox.com [64.7.143.116]) by beaver.fastcrypt.com (Postfix) with ESMTP id 276B01580639; Fri, 13 Apr 2007 16:29:01 -0400 (EDT) In-Reply-To: <20070413184748.GA6562@allhats.xcski.com> References: <20070413184748.GA6562@allhats.xcski.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3EF68121-73CD-45FA-996F-F48378CE051F@fastcrypt.com> Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: What changed? Date: Fri, 13 Apr 2007 16:24:57 -0400 To: Paul Tomblin X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/39 X-Sequence-Number: 16888 Paul, Have you tried a recent driver ? As Mark pointed out we have some issues with timestamps because java does not recognize two types. Dave On 13-Apr-07, at 2:47 PM, Paul Tomblin wrote: > This code worked in various versions of Postgres up to and > including 7.4 > (as bundled with CentOS 4.3), but fails on 8.1 (as bundled with CentOS > 5.0) with an exception about being unable to determine the type of > parameter $2: > > java.sql.Timestamp startDBDate = null; > if (startDate != null) > { > startDBDate = new java.sql.Timestamp(startDate.getTime()); > } > > try > { > PreparedStatement stmt = con.prepareStatement( > "SELECT " + SHOWLIST_COLUMNS + > "FROM showlists s, showlistsplaylists sc " + > "WHERE s.id = sc.showlistid AND " + > " sc.playlistid = ? AND " + > " (? IS NULL OR s.showtime >= ?) " + > "ORDER BY screen, showtime"); > int p = 1; > stmt.setLong(p, playlistID); > p++; > if (startDate == null) > { > stmt.setNull(p, java.sql.Types.TIMESTAMP); > p++; > stmt.setNull(p, java.sql.Types.TIMESTAMP); > p++; > } > else > { > stmt.setTimestamp(p, startDBDate); > p++; > stmt.setTimestamp(p, startDBDate); > p++; > } > > ResultSet rs = stmt.executeQuery(); > SortedSet retList = parseShowListResultSet(con, rs, > venueInfoList); > > stmt.close(); > > Based on something I saw in the list archives, I got it to work by > casting > the timestamp parameters using "?::timestamptz". But I'm wondering > why > that changed, and are there any other gotchas lurking? Should I > cast any > timestamp parameter to either ::timestamp or ::timestamptz > depending on > what it is in the db? > > -- > Paul Tomblin http://blog.xcski.com/ > I think I'd like to see a Simpsons episode starting up with Bart > Simpson > writing 'I will not attempt to undermine the Usenet Cabal'. > -- J. D. Falk > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match