Skip site navigation (1) Skip section navigation (2)

Re: Implementing Frontend/Backend Protocol

From: Raimon Fernandez <coder(at)montx(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Implementing Frontend/Backend Protocol
Date: 2009-10-23 09:25:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-interfaces

We're investigating again the idea of creating a directly connection  
between our app and postgresql, using TCP/IP.

I found some examples in src/interfaces/libpq but they are in C, and  
also found interesting the ones from Lisp.

But I can't figure it out almost nothing ...


So, maybe a practical example would be better:

I can start a connection, but I'm getting an error when I send the  
start up sequence.

StartupMessage (F)
Length of message contents in bytes, including self.

** The total length including the total string => 33

The protocol version number. The most significant 16 bits are the  
major version number (3
for the protocol described here). The least significant 16 bits are  
the minor version number
(0 for the protocol described here).

** 300

The protocol version number is followed by one or more pairs of  
parameter name and value
strings. A zero byte is required as a terminator after the last name/ 
value pair. Parameters can
appear in any order. user is required, others are optional. Each  
parameter is specified as:
The parameter name. Currently recognized names are:
The database user name to connect as. Required; there is no default.
The database to connect to. Defaults to the user name.
Command-line arguments for the backend. (This is deprecated in favor  
of setting indi-
vidual run-time parameters.)
In addition to the above, any run-time parameter that can be set at  
backend start time might
be listed. Such settings will be applied during backend start (after  
parsing the command-line
options if any). The values will act as session defaults.
The parameter value.

Ok, I can't see how I have to separate the name/value, maybe with a  
slash / ?

And how I have to separate the next name/value ?

I understand that I have to add a byte 0 at the end of the last name/ 
value but not between them ?


this is what I send:





On 19/04/2007, at 4:03, John DeSoi wrote:

> It takes a bit of work to implement, but it is not too difficult.  
> What is your target implementation language?
> Here is source library for Lisp:
> John
> On Apr 17, 2007, at 5:22 AM, Raimon Fernandez wrote:
>> We want to implement, or at least, investigate how difficult will  
>> be to talk directly with PostgreSQL via TCP/IP.
>> We have the original documentation, and in chapter 43 there is some  
>> info.
>> Do you know where can we find examples (code) to start the project ?
>> We found some but where not related to TCP/IP.
> John DeSoi, Ph.D.
> Power Tools for PostgreSQL
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>      choose an index scan if your joining column's datatypes do not
>      match

In response to


pgsql-interfaces by date

Next:From: Raimon FernandezDate: 2009-10-26 22:44:15
Subject: Implementing Frontend/Backend Protocol TCP/IP
Previous:From: Piaff33zDate: 2009-09-05 17:53:13
Subject: Re: problem on test perlu trigger function.

pgsql-general by date

Next:From: Jayaraman, Rajaram (STSD)Date: 2009-10-23 10:39:43
Subject: Re: FATAL error "could not find function "alt_to_mic" in file
Previous:From: Kareem SedkiDate: 2009-10-23 08:38:27
Subject: How to check whether a data type can be cast to another

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group