Re: Handling protocol not supported error message when - Mailing list pgsql-hackers

From Francisco Figueiredo Jr.
Subject Re: Handling protocol not supported error message when
Date
Msg-id 3F109F24.3050000@yahoo.com.br
Whole thread Raw
In response to Re: Handling protocol not supported error message when working with protocol 2 and 3  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

> "Francisco Figueiredo Jr." <fxjrlists@yahoo.com.br> writes:
> 
>>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- .
> 
> 
> I'd suggest using the same methods libpq does.  You do have to be
> prepared to accept an old-format error message.
> 

Yes, I'm prepared, but the problem is how can I in advance know which 
format the message is, as I'm expecing a 3 version and comes a 2 version 
error message?
Uhmmmm, I could see in the following line in libpq how it does it:
if (beresp == 'E' && (msgLength < 8 || msgLength > 30000))

So this is how it checks ahead, if the value is very large, the 
msgLength would be bigger than 30000 and this would mean a string error 
and so the 2.0 version error message. I think I will get this approach too.

Thanks Tom Lane.




>             regards, tom lane
> 


-- 
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 by date:

Previous
From: Joe Conway
Date:
Subject: Re: php with postgres
Next
From: "Maksim Likharev"
Date:
Subject: Re: [GENERAL] PG crash on simple query, story continues