Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 8FF2D9FB548 for ; Fri, 13 Apr 2007 16:16:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 66530-02 for ; Fri, 13 Apr 2007 16:16:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 956A49FB226 for ; Fri, 13 Apr 2007 16:16:18 -0300 (ADT) Received: MIR3-FS.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes by MIR3-FS.mir3.com; 13 Apr 2007 12:16:15 -0700 Subject: Re: What changed? From: Mark Lewis To: Paul Tomblin Cc: pgsql-jdbc@postgresql.org In-Reply-To: <20070413184748.GA6562@allhats.xcski.com> References: <20070413184748.GA6562@allhats.xcski.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Fri, 13 Apr 2007 12:16:14 -0700 Message-Id: <1176491774.8630.101.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/36 X-Sequence-Number: 16885 This is addressed in the FAQ, look at the section titled, "I upgraded from 7.x to 8.x. Why did my application break?" http://jdbc.postgresql.org/documentation/faq.html#upgradeTo80 There's also plenty of discussion in the archives that you'll find. -- Mark Lewis On Fri, 2007-04-13 at 14:47 -0400, 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? >