Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C1875633B43 for ; Mon, 20 Apr 2009 18:51:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 05767-07 for ; Mon, 20 Apr 2009 18:51:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 34B726336E0 for ; Mon, 20 Apr 2009 18:51:30 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id ABB49AA9C; Mon, 20 Apr 2009 17:51:27 -0400 (EDT) Date: Mon, 20 Apr 2009 17:51:27 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Heikki Linnakangas cc: Oliver Jowett , Tom Lane , John Lister , pgsql-jdbc@postgresql.org Subject: Re: Query preparation In-Reply-To: <49E71286.9020500@enterprisedb.com> Message-ID: References: <49E4A6FA.7050407@kickstone.com> <49E4AEAC.5000700@opencloud.com> <49E4F20C.6040900@kickstone.com> <18961.1239742344@sss.pgh.pa.us> <49E4FBB0.40405@kickstone.com> <49E5D64F.8010603@enterprisedb.com> <49E5DD02.2060909@opencloud.com> <10718.1239808274@sss.pgh.pa.us> <49E71286.9020500@enterprisedb.com> 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=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/72 X-Sequence-Number: 19519 On Thu, 16 Apr 2009, Heikki Linnakangas wrote: > Here's the patch. Describe message is only sent in the first invocation > of a query. The Field[] array constructed from the RowDescription > message is saved in the SimpleQuery object for reuse. > Applied with minor revisions. When sending a Describe Statement message you'll also get a Row Description message back, so we need to add the query to the pendingDescribePortalQueue there as well. Doing this always avoids some of the other special casing you tried to put in to handle describe statement (which didn't work if you see the new unit test I added). While looking at this code it reminded me that we're also sending Describe Statement too often and I've fixed that to only do it when necessary. Previously the following code would describe the statement for every execution. PreparedStatement ps = conn.prepareStatement("SELECT ?::int"); for (int i=0; i<100; i++) { ps.setObject(1, new Integer(i), Types.OTHER); ResultSet rs = ps.executeQuery(); } Also the JDBC coding style guidelines require four space indentation rather than tabs, so you'll see some additional changes from that. Kris Jurka