pg.ddx.io pgsql-interfaces@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Frontend/Backend Protocol 2+ messages / 2 participants [nested] [flat]
* Frontend/Backend Protocol @ 1999-07-22 07:01 Jonathan Dale <jdale@fla.fujitsu.com> 1999-07-23 00:30 ` Re: [INTERFACES] Frontend/Backend Protocol Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: Jonathan Dale @ 1999-07-22 07:01 UTC (permalink / raw) To: pgsql-hackers@postgresql.org; pgsql-ports@postgresql.org; pgsql-interfaces Hi, I am trying to write an interface for accessing the postmaster and subsequently a postgres database server in a language that our group has written, which is called APRIL. However, I am having a few problems making the connection. I appear to be able to make a successfuly connection to the postmaster by making a normal socket connection to port 5432 and sending a startup packet, which consists of: 00 00 01 20 as the length (296 bytes) 00 02 00 00 as the major and minor protocol numbers (2.0) "dbname\0" as a 64 byte string representing the database name "postgres\0" as a 32 byte string representing the user name "\0" as a 64 byte string representing the options "\0" as a 64 byte string representing unused bytes "\0" as a 64 byte string representing the tty And I get back: "R" 00 00 00 00 which indicates a successful connection However, when my process has read this, the postmaster displays the following error: FATAL 1: Socket command type unknown and the connection is closed. Does anyone have any idea of what I am doing wrong? I assumed that the postmaster would fork a new postgres process to handle my connection and I should be expecting some data on the socket to tell me that the postgres process is ready for an SQL query. The postmaster is being executed with the -i option. Thanks in advance, Jonathan +-------------------------------------------------------------------+ | "Never settle with words what you can accomplish with a | | flamethrower." -- Bruce Feirstein | +-------------------------------------------------------------------+ Attachments:^ permalink raw reply [nested|flat] 2+ messages in threadjdale.vcf (text/x-vcard, 395B) download
begin:vcard n:Dale;Jonathan tel;fax:+1 408 530 4515 tel;work:+1 408 530 4543 x-mozilla-html:FALSE url:http://www.nar.fla.com/ org:Fujitsu Laboratories of America, Incorporated;Network Agent Research Group adr:;;595 Lawrence Expressway;Sunnyvale;California;94086;USA version:2.1 email;internet:jdale@fla.fujitsu.com title:Member of Research Staff x-mozilla-cpt:;-11968 fn:Jonathan Dale end:vcard
* Re: [INTERFACES] Frontend/Backend Protocol 1999-07-22 07:01 Frontend/Backend Protocol Jonathan Dale <jdale@fla.fujitsu.com> @ 1999-07-23 00:30 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 1999-07-23 00:30 UTC (permalink / raw) To: jdale@fla.fujitsu.com; +Cc: pgsql-hackers@postgreSQL.org; pgsql-ports@postgreSQL.org; pgsql-interfaces Jonathan Dale <jdale@fla.fujitsu.com> writes: > And I get back: > "R" 00 00 00 00 which indicates a successful connection Looks good so far (I suppose you are using 'trust' authentication mode). > However, when my process has read this, the postmaster displays the > following error: > FATAL 1: Socket command type unknown > and the connection is closed. No, the postmaster didn't send that; the backend did. Looks like you sent one byte too many, probably a null byte, and the backend received it as the first input data byte. Since it's not a valid protocol command character, the backend gives up and dies. > I assumed that the > postmaster would fork a new postgres process to handle my connection ... it did ... > and I should be expecting some data on the socket to tell me that the > postgres process is ready for an SQL query. You should have gotten a ReadyForQuery message if you are talking to a 6.4 or later backend, and if you used the right protocol version number in the connect request. I speculate that you have an old server, or you asked for protocol version 1, or you miscounted bytes and missed the appearance of the ReadyForQuery ('Z') message. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-07-23 00:30 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 1999-07-22 07:01 Frontend/Backend Protocol Jonathan Dale <jdale@fla.fujitsu.com> 1999-07-23 00:30 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox