Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C0A9F658F56 for ; Mon, 17 May 2010 15:08:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 77911-02-9 for ; Mon, 17 May 2010 18:08:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id BD2DC655C75 for ; Mon, 17 May 2010 15:06:10 -0300 (ADT) Received: from mail63.csoft.net (localhost [127.0.0.1]) by mail63.csoft.net (Postfix) with ESMTP id CB8AB2845E; Mon, 17 May 2010 14:06:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sel1; bh=C639jozlO1w6OPUvRLH3kxmRcDI=; b=cI89D7 jMB3O6rPIBrrwojuw4A+u6Yi3tY5/xR9hSs7tx/MFd+5kTgKLkbIkSfn1PjRs1ZH cWcNykZIPhssxGaLMcRgWboRWkgyVFVWWaLNfBO5z235IwRVhk6sJFZFJp3Yfd6s Ar5bYvyYU6dMJMkm2egdYZvh4YSBFTyIFQz30= Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id C8B812845D; Mon, 17 May 2010 14:06:08 -0400 (EDT) Received: by leary.csoft.net (Postfix, from userid 1112) id A466DA3A8; Mon, 17 May 2010 14:06:08 -0400 (EDT) Date: Mon, 17 May 2010 14:06:08 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Andre Burkovski cc: pgsql-jdbc@postgresql.org Subject: Re: 8.4 vs 8.1 AbstractJdbc2Array - Array retrieval In-Reply-To: <4BF17FAE.5060402@gmx.net> Message-ID: References: <4BF17FAE.5060402@gmx.net> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/39 X-Sequence-Number: 20523 On Mon, 17 May 2010, Andre Burkovski wrote: > I have this unexpected Exception > "org.postgresql.util.PSQLException: An I/O error occured while sending to the > backend." > when i try to recover contents of an java.sql.Array via getArray() method. > > I don't have an SSCCE (http://sscce.org/) yet, but for the same piece of code > i tried both drivers: 8.1.414 and 8.4.701 > And for the 8.1.414 the code runs fine. For the 8.4.701 (jdbc3 and jdbc4 > variant) i got the error above. > > I did a little digging and debugging and found the following: > The cause of the error can be found in line 165 of > org.postgresql.jdbc2.AbstractJdbc2Array.java (8.4.701src) > The the line > "connection.getTypeInfo().getArrayDelimiter(oid);" > requires the connection to be open. > This is not the case for 8.1.414! > > This creates trouble, as i am using an ORM where data is cached. The data is > available, but 8.4 driver requires the connection to be open. In the case of > 8.1 driver the ORM is able to manage the retrieve the data via getArray() > method although the connection is closed. The change that was made between 8.1 and 8.4 was that in 8.1 the JDBC driver assumed that the array delimiter would be a comma which is true for most types, but not all. The 8.4 driver checks with the server to see what the actual delimiter is. So this change is intentional and the fact that you could access parts of a ResultSet without a valid Connection is just luck. After Connection close you really shouldn't be able to access anything. Kris Jurka