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: E084987E-A212-4B70-8CFF-D83AA00629C5@montx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

Hello,

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)
Int32
Length of message contents in bytes, including self.

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

Int32(196608)
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:
String
The parameter name. Currently recognized names are:
user
The database user name to connect as. Required; there is no default.
database
The database to connect to. Defaults to the user name.
options
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.
String
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 ?

user/postgresdatabase/scann0

this is what I send:

33300user/postgresdatabase/scann0

thanks,

regards,

r.

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:
>
> http://common-lisp.net/project/postmodern/
>
> 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.
> http://pgedit.com/
> 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

Responses

Browse pgsql-general by date

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

Browse pgsql-interfaces by date

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