X-Original-To: pgsql-hackers@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6521B475F16; Thu, 24 Apr 2003 13:29:05 -0400 (EDT) Received: from mail.xythos.com (unknown [206.14.210.116]) by postgresql.org (Postfix) with ESMTP id BA8B7475F09; Thu, 24 Apr 2003 13:29:03 -0400 (EDT) Received: from ravms by mail.xythos.com with mail-ok (Exim 3.36 #3) id 198kWt-0003Fj-00; Thu, 24 Apr 2003 17:29:03 +0000 Received: from localhost.localdomain ([127.0.0.1] helo=xythos.com) by mail.xythos.com with asmtp (Exim 3.36 #3) id 198kWt-0003FY-00; Thu, 24 Apr 2003 17:29:03 +0000 Message-ID: <3EA81EDF.9030306@xythos.com> Date: Thu, 24 Apr 2003 10:29:03 -0700 From: Barry Lind User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-hackers@postgresql.org, pgsql-interfaces@postgresql.org Subject: Re: First draft of new FE/BE protocol spec posted for comments References: <10770.1050448110@sss.pgh.pa.us> <3EA6D372.3000406@xythos.com> <9278.1051139337@sss.pgh.pa.us> In-Reply-To: <9278.1051139337@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Envelope-To: tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org, pgsql-interfaces@postgresql.org X-Spam-Status: No, hits=-38.8 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/855 X-Sequence-Number: 38345 Tom Lane wrote: > Barry Lind writes: >>My final question is more of an implementation question than comments on >>the protocol itself. Since the jdbc driver needs to be backwardly >>compatible with 7.3 and earlier servers that will speak the 2.0 >>protocol, what is the recomended way to write the client so that it can >>'detect' which protocol to use. > > I'd do it the other way: send a 3.0 connection request and then, if you > get a "bad protocol" error response, send a 2.0 connection request. > You do have to be a little careful about parsing the connection response > since if it's 'E' it might be either 2.0 or 3.0 layout, but that can be > handled without too much difficulty I think. (Look at the > already-committed code in libpq's fe-connect.c.) > OK. So this is what I plan to do: First try a 3.0 connection. If an error response is received from the connection attempt then check if the error is in a 3.0 format, if yes then report the error, else if not 3.0 format then try a 2.0 connection, if that returns an error then report it. thanks, --Barry