Re: [HACKERS] First draft of new FE/BE protocol spec posted for comments - Mailing list pgsql-interfaces

From Sander Steffann
Subject Re: [HACKERS] First draft of new FE/BE protocol spec posted for comments
Date
Msg-id 000801c309dd$b1789d00$64c8a8c0@10ww.steffann.nl
Whole thread Raw
In response to First draft of new FE/BE protocol spec posted for comments  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-interfaces
Hi,

> 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.  The only thing I can think of is to
> start by sending a version 2 protocol message (which will work across
> all the database versions that jdbc will be supporting) then if it finds
> it it talking to a 7.4 server, close the connection and reconnect using
> the version 3 protocol.  This will double connection time when
> connecting to a 7.4 server but is the only way I can think of to do
> this.  Is there a better way that I am missing?

Since I guess there will be a lot more 7.4+ servers than older servers I
think you should at least try protocol v3 first, and if that fails try v2.
Try to keep it as fast as possible for the most used version.

Could be that that this isn't possible though. I don't know the protocol
well enough to be sure. Maybe its an idea to introduce a new messagetype at
protocol level with which the client can ask the server which protocol
versions it supports. That would make protocol changes a lot easier in the
future. And if the server doesn't understand that new messagetype you know
you are talking to a v2-only server :)

Bye
Sander



pgsql-interfaces by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: ECPG thread-safety
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] First draft of new FE/BE protocol spec posted for comments