<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thank you<br>
    </p>
    <p>the point of my set_search_path function is to be dynamic, it
      depends on current_user, I cannot declare this as immutable, and I
      don't want this to be cached by pgpool (I have caching enabled).</p>
    <p>I am wondering :</p>
    <p>a) How easy it could be to implement a new feature in pgpool to
      declare functions that will have to be routed in both primary and
      replica (POOL_BOTH in <span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">src/context/pool_query_context.c</span>
      </span>).</p>
    <p>b) if there was a mechanism in postgresql that a SET
      foo_guc_var="val" would result in calling a function.<br>
    </p>
    <div class="moz-cite-prefix">On 11/14/23 02:18, Tatsuo Ishii wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20231114.091807.706567631886378504.t-ishii@sranhm.sra.co.jp">
      <pre class="moz-quote-pre" wrap="">Hi,

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Hello pgpool world

pgpool thankfully sends all SET commands to both primary and secondary
nodes. Hence, it handles correctly SET search_path TO ...;  But what
if we have a more complex function or procedure to handle the setting
search_path? How can we tell pgpool to execute this function/procedure
to all load balancing nodes ?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Unfortunately there's no such a feature in Pgpool-II.

Maybe you could create wrapper functions calling the search_path
setting function, say f1 and f2, then call f1 and f2. f1 is declared
as a volatile function, thus will be sent to primary. On the other
hand f2 is declared as immutable and will be sent to the load balance
node (of course you can use write_function_list or read_function_list
instead).

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: <a class="moz-txt-link-freetext" href="http://www.sraoss.co.jp/index_en/">http://www.sraoss.co.jp/index_en/</a>
Japanese:<a class="moz-txt-link-freetext" href="http://www.sraoss.co.jp">http://www.sraoss.co.jp</a>
</pre>
    </blockquote>
  </body>
</html>