[pgpool-general: 8891] Re: Prepared statements over pgpool ?

Tatsuo Ishii ishii at sraoss.co.jp
Wed Jul 12 11:33:40 JST 2023


> I see. That's the problem. Pgpool-II cannot handle queries on a single
> line well (we call it "multi statement query"). In this case only
> "PREPARE mark_rels_by_node..." is recognized by Pgpool-II but "PREPARE
> mark_rels_by_way..." is not.  Currently there's no workaround for
> this.

After more thought I come up with attached patch. In the patch pgpool
check each parse tree (corresponding ro each PREPARE statement in this
case), and memorize the prepared statement names for later bind
message. It works at least for me.
Below is the output from pgproto tool.

FE=> Query (query="PREPARE mark_rels_by_node(int8) AS SELECT $1;PREPARE mark_rels_by_way(int8) AS SELECT $1")
<= BE CommandComplete(PREPARE)
<= BE CommandComplete(PREPARE)
<= BE ReadyForQuery(I)
FE=> Bind(stmt="mark_rels_by_node", portal="")
FE=> Describe(portal="")
FE=> Execute(portal="")
FE=> Sync
<= BE BindComplete
<= BE RowDescription
<= BE DataRow
<= BE CommandComplete(SELECT 1)
<= BE ReadyForQuery(I)
FE=> Bind(stmt="mark_rels_by_way", portal="")
FE=> Describe(portal="")
FE=> Execute(portal="")
FE=> Sync
<= BE BindComplete
<= BE RowDescription
<= BE DataRow
<= BE CommandComplete(SELECT 1)
<= BE ReadyForQuery(I)
FE=> Terminate

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multi-statement-prepare.patch
Type: text/x-patch
Size: 3209 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20230712/2da74dbd/attachment.bin>


More information about the pgpool-general mailing list