Handling protocol not supported error message when working with protocol 2 and 3
От | Francisco Figueiredo Jr. |
---|---|
Тема | Handling protocol not supported error message when working with protocol 2 and 3 |
Дата | |
Msg-id | 3F108ECE.50100@yahoo.com.br обсуждение исходный текст |
Ответы |
Re: Handling protocol not supported error message when working with protocol 2 and 3
|
Список | pgsql-hackers |
Hi all, I'm finishing the implementation of the protocol 3.0 and now I'm working in how to connect to server using protocol 3.0 when the server doesn't support it 7.3- . As suggested in a previous mail about how to handle with both protocol versions, I'm trying first to connect using version 3.0. The problem is if the server is a 7.3 or earlier, it would answer with a non supported protocol error message, but as I'm in the protocol 3.0 version mode, I would expect a error message in the new format and not in the 2.0 format. How I could handle it? I know this error happens early in the connection establishment, when I send the StartupPacket and I could use this info to do some choices about when to use the version 2 or 3. The problem is that I also could get a lot of errors when sending the startup packet, as password incorrect, database and others. I was thinking about examining the first 4 bytes ( as this is where the message length is located) and try if these bytes could be translated to "FATA" which would mean the "FATAL: unsupported frontend protocol\n" error. But I think this would be a big hack. Is there a more elegant solution? I know this question was alread raised some time ago, but I couldn't find it. Thanks in advance. -- Regards, Francisco Figueiredo Jr. ------ "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi
В списке pgsql-hackers по дате отправления: