Re: Postgre Protocol

From: Greg <grigorey(at)yahoo(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgre Protocol
Date: 2010-06-29 14:35:45
Message-ID: 264695.39054.qm@web24308.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Ok, after some though I got the error: reading integer from stream was done in a wrong way. So with fixed stream reader and after sending start-up packet, server response with AuthenticationClearTextPassword (as Tom said), so now its sending the password to the database and see how this turn out.

Thanks Tom!

--- On Tue, 29/6/10, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [NOVICE] Postgre Protocol
To: "Greg" <grigorey(at)yahoo(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Date: Tuesday, 29 June, 2010, 0:10

Greg <grigorey(at)yahoo(dot)co(dot)uk> writes:
> Hi Tom, thanks for the quick reply. I've looked at the break points and you are right there are 7 more bytes with data send with AuthenticationOk message, so I think thats what I need to look at :) (Im sure this is just a confirmation that everything is ok).
> May I ask, sequence of bytes after the AuthenticationOk messages is: 0080003; Is this sequence represent BackendKeyData or values for Authentication*** status codes, or Im completely worng and it is realy nothing but confirmation for a frontend how the database applied options passed with start-up packet?

That doesn't look right at all.  Per the start-up portion of the Message
Flow section:

    After having received AuthenticationOk, the frontend must wait for further messages from the server. In this phase a backend process is being started, and the frontend is just an interested bystander. It is still possible for the startup attempt to fail (ErrorResponse), but in the normal case the backend will send some ParameterStatus messages, BackendKeyData, and finally ReadyForQuery.

I'd expect ten or so ParameterStatus messages (depending on which PG
version you are working with), so there's easily going to be 100+ bytes
between the AuthenticationOk and ReadyForQuery messages.  As I said
earlier, the backend will not flush this data out until it's ready for a
query, so you should expect to see it all arriving in one network
packet.

[ eyeballs that data some more... ]  Are you *sure* you've collected an
AuthenticationOk message?  The various authentication response messages
all have the same type code ('R'), and 0000000800000003 would be what
follows that for AuthenticationCleartextPassword.  Maybe the backend is
really challenging you for a password.  Have you checked what ought to
happen according to pg_hba.conf?

            regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bidski 2010-06-30 08:47:21 Compiling under MSYS and Windows 7
Previous Message Vibhor Kumar 2010-06-29 09:55:58 Re: [NOVICE] Prepared statement issue in Pgpool-II