<div dir="ltr"><div>I am not sure if this is related. By in my node.js setup (pg 6.1.5, Postgres 9.6 and pgpool-II 3.6.1), parameterized queries just don&#39;t work with pg_pool caching. Queries that use parameters like $1 etc run the first time (when they are not cached) and then subsequent ones just hang.</div><div>-AJ</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 17, 2017 at 4:44 PM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">&gt; Hello.<br>
&gt;<br>
&gt; If  I  try to establish connection between pgpool and erlang (using pgapp library <a href="https://github.com/epgsql/pgapp" rel="noreferrer" target="_blank">https://github.com/epgsql/<wbr>pgapp</a>  )<br>
&gt; then  session  simply  hangs after erlang  client  sends command<br>
&gt; SELECT typname, oid::int4, typarray::int4 FROM pg_type WHERE typname = ANY($1::varchar[])<br>
&gt; parameters: $1 = &#39;{hstore,geometry}&#39;<br>
&gt; If erlang application connects to PgSQL server directly, then connection is established without problems.<br>
&gt;<br>
&gt; However, if i connect via psql to pgpool and issue the same statement -<br>
&gt; SELECT typname, oid::int4, typarray::int4 FROM pg_type WHERE typname = ANY(&#39;{hstore,geometry}&#39;::<wbr>varchar[]);<br>
&gt; then this request is processed normally:<br>
&gt;  typname |  oid  | typarray<br>
&gt; ---------+-------+----------<br>
&gt;  hstore  | 19898 |    19903<br>
&gt; (1 row)<br>
&gt;<br>
&gt;<br>
&gt; i&#39;ve turned on &quot;debug5&quot; messages and I can see these lines in the pgpool log when erlang library is connecting, but I have no idea what other lines are significant.<br>
&gt; May 17 18:02:02 ip-172-31-20-153 [23121]: [432086-1] pgpool2 DEBUG:  decide where to send the queries<br>
&gt; May 17 18:02:02 ip-172-31-20-153 [23121]: [432086-2] pgpool2 DETAIL:  destination = 2 for query= &quot;SELECT typname, oid::int4, typarray::int4 FROM pg_type WHERE typname = ANY($1::varchar[])&quot;<br>
&gt; May 17 18:02:02 ip-172-31-20-153 [23121]: [432087-1] pgpool2 DEBUG:  system catalog walker, checking relation &quot;pg_type&quot;<br>
&gt; May 17 18:02:02 ip-172-31-20-153 [23121]: [432134-1] pgpool2 DEBUG:  do_query: extended:1 query:&quot;SELECT count(*) FROM pg_class AS c, pg_namespace AS n WHERE c.oid = to_regclass(&#39;&quot;pg_type&quot;&#39;) AND c.relnamespace = n.oid AND n.nspname = &#39;pg_catalog&#39;&quot;<br>
&gt;<br>
&gt; and these are lines from the log file if i run this query by hand from psql:<br>
&gt; May 17 18:12:24 ip-172-31-20-153 [23539]: [432779-1] pgpool2 DEBUG:  decide where to send the queries<br>
&gt; May 17 18:12:24 ip-172-31-20-153 [23539]: [432779-2] pgpool2 DETAIL:  destination = 2 for query= &quot;SELECT typname, oid::int4, typarray::int4 FROM pg_type WHERE typname = ANY(&#39;{hstore,geometry}&#39;::<wbr>varchar[]);&quot;<br>
&gt; May 17 18:12:24 ip-172-31-20-153 [23539]: [432779-3] pgpool2 LOCATION:  pool_query_context.c:429<br>
&gt; May 17 18:12:24 ip-172-31-20-153 [23539]: [432780-1] pgpool2 DEBUG:  system catalog walker, checking relation &quot;pg_type&quot;<br>
&gt; May 17 18:12:24 ip-172-31-20-153 [23539]: [432780-2] pgpool2 LOCATION:  pool_select_walker.c:374<br>
&gt; May 17 18:12:24 ip-172-31-20-153 [23539]: [432781-1] pgpool2 DEBUG:  do_query: extended:0 query:&quot;SELECT count(*) FROM pg_class AS c, pg_namespace AS n WHERE c.oid = to_regclass(&#39;&quot;pg_type&quot;&#39;) AND c.relnamespace = n.oid AND n.nspname = &#39;pg_catalog&#39;&quot;<br>
&gt;<br>
&gt; There is a difference - when request is sent from erlang, then &quot;extended:1&quot;, but when i ru query from psql, then &quot;extended:0&quot;. Perhaps this is important?<br>
<br>
</div></div>Maybe. erlang seems to use &quot;extended query&quot;, which is also used in Java.<br>
<span class=""><br>
&gt; I understand that it looks like the problem on the erlang library side, but perhaps you, basing on your pgpool knowledge, could suggest what is causing this incompatibility between erlang pgsql library and pgpool?<br>
&gt; Perhaps this old thread has something in common with my problem: <a href="http://lists.pgfoundry.org/pipermail/pgpool-general/2011-February/003409.html" rel="noreferrer" target="_blank">http://lists.pgfoundry.org/<wbr>pipermail/pgpool-general/2011-<wbr>February/003409.html</a> ?<br>
<br>
</span>Not sure. Extended query is pretty complex. Extended query users for<br>
Pgpool-II are mostly Java. So it is possible that erlang (or pgapp)<br>
reveleas new bug with Pgpool-II. Your Pgpool-II log is imcoplete. To<br>
invesigate the problem, I need complete Pgpool-II log: starting from<br>
the query issued to the point Pgpool-II hangs.<br>
<br>
Also please let us know what version of Pgpool-II you using exactly.<br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_<wbr>en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.<wbr>jp</a><br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
pgpool-general mailing list<br>
<a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
<a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/<wbr>listinfo/pgpool-general</a><br>
</div></div></blockquote></div><br></div>