[Pgpool-hackers] Transforming SQL to prepared statements inside pgpool-II

Tatsuo Ishii ishii at sraoss.co.jp
Sun May 8 00:11:29 UTC 2011


Sorry for delay. I didn't noticed because it was a private email.

> "Well protocol handling of simple query(regular SQL) and prepared query
> is totally different. Simple query protocol is simple: just send a
> query and receive the result. The protocol used for prepared query
> (called "extended query protocol") is much more complex: it has
> several phases: parse, bind, execute. I suggest you carefully read
> "Frontend/Backend Protocol" section of PostgreSQL document. However I
> can think of anything which makes your idea impossible at this point."
> 
> I just wanted to note that I have started working on this idea. Work is very slow at the moment, but I am getting a grasp of what should be done.
> 
> I would like to ask for little help about debugging the frontend/backend protocol. I am using raw buffer and pool_send_and_wait() at the moment for constructing the extended protocol messages. I am getting errors like insufficient data left in message and invalid message format. So my messages aren't in proper format, but I am having hard time to see what went wrong. I guess the best way to debug this is to add elog(DEBUG1) messages to the libpq backend, and see what the data looks like in there?

Another idea is tweaking pool_write() so that it displays what data it
is sending.

> Libpq is looking really attractive, but I guess using it directly is out of the question. However, I wonder if it would be wise to port a part of it to pgpool-II, that is the nice handling of message construction and reading in src/interfaces/libpq/fe-misc.c? The file is a bit over 1200 lines, but not all of it is needed. The other choice is to write the needed functions to write parse/bind/execute messages.

I don't think fe-misc.c is usefull for you becauae it just handles
very low level of protoocl, which is totally different from
pgpool-II's architecture. Probably you should look into fe-exec.c how
to construct extended protocol messages.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


More information about the Pgpool-hackers mailing list