X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 851D33A2900 for ; Sat, 23 Oct 2004 22:21:07 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44046-06 for ; Sat, 23 Oct 2004 21:20:43 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 7D8453A28FE for ; Sat, 23 Oct 2004 22:21:01 +0100 (BST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CLTJj-0000bK-00; Sun, 24 Oct 2004 10:20:51 +1300 Message-ID: <417ACB47.3090101@opencloud.com> Date: Sun, 24 Oct 2004 10:21:11 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (X11/20041021) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Kris Jurka , Dave Smith , pgsql-jdbc@postgresql.org Subject: Re: Problem with fixed length fields. References: <1098532450.2684.3.camel@davehome> <26657.1098556819@sss.pgh.pa.us> <417AC2C2.40605@opencloud.com> <27388.1098564647@sss.pgh.pa.us> In-Reply-To: <27388.1098564647@sss.pgh.pa.us> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/247 X-Sequence-Number: 11352 Tom Lane wrote: > Oliver Jowett writes: > >>Tom Lane wrote: >> >>>Can you refrain from assigning a type at all? > > >>Pushing on blindly with a Bind without knowing the actual type of the >>parameters you're sending seems possible but dangerous. It'd preclude >>using binary-format parameters for unknown types, at a minimum. > > > I had in mind doing this *only* for setString; you would essentially be > assuming that the resolved type was text, varchar, or char, which have > interchangeable binary formats. But the driver has no guarantee that the backend will infer one of these particular types, right? > It would probably be a good idea to do a Describe Statement to verify > that the parameter got resolved as one of those, but this need not add > a round-trip, since you could issue it with the Parse message. Currently the driver issues Parse, Bind, Describe(portal), Execute, Sync. If I understand correctly, you're suggesting we do Parse, Describe(statement), Bind, Describe(portal), Execute, Sync. If the backend infers something other than a text-based type in Parse, doesn't Bad Stuff happen? (e.g. inserting random data into your database..) We could certainly notice the type mismatch when the results of the statement Describe come back, but by then it is too late, the query has already been executed. -O