<div dir="ltr">The behaviour should be a bit further different...<div><br></div><div>The log triggers are supposed to be suppressed on *all* nodes when DDL/DML is being run via EXECUTE SCRIPT by virtue of having the GUC set to &quot;local&quot;.</div>
<div><br></div><div>In effect, what&#39;s to happen is...</div><div><br></div><div>- Start of EXECUTE SCRIPT processing:</div><div>   <span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre">set session_replication_role to local; </span></div>
<div><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre"><br></span></div><div><font color="#000000" face="monospace"><span style="font-size:12px;white-space:pre"> - Process DDL/DML statements</span></font></div>
<div><font color="#000000" face="monospace"><span style="font-size:12px;white-space:pre"><br></span></font></div><div><font color="#000000" face="monospace"><span style="font-size:12px;white-space:pre">- </span></font><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre">set session_replication_role to replica;</span></div>
<div><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre">That&#39;s the code in both 2.0 and 2.1 branches.  (See src/backend/remote_worker.c, look for the case statement processing &quot;DDL_SCRIPT&quot;.)</span></div>
<div><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:pre">In master (pre-2.2), we&#39;re not explicitly setting the role for DDL; that *should* be OK as the reference in dbutil.c is, I think, invoked when running a connection to a subscriber.</span></div>
<div><br></div><div><div>cbbrowne@cbbrowne ~/P/slony1-engine.master&gt; ack-grep session_replication_role</div><div>src/slonik/dbutil.c</div><div>166:                             &quot;SET session_replication_role TO local; &quot;);</div>
<div><br></div><div>src/slon/remote_worker.c</div><div>353:                                            &quot;set session_replication_role = replica; &quot;);</div><div>4958:                            &quot;set session_replication_role to replica;\n&quot;</div>
<div><br></div><div>src/slony_logshipper/parser.y</div><div>327:                                                    &quot;set session_replication_role to replica;&quot;) &lt; 0)</div><div><br></div><div>src/slony_logshipper/scan.l</div>
<div>135:session_replication_role { return K_SESSION_ROLE;   }</div><div><br></div><div>tools/slony1_dump.sh</div><div>301:set session_replication_role=&#39;replica&#39;;</div><div><br></div><div>doc/adminguide/triggers.sgml</div>
<div>23:&lt;para&gt; A new GUC variable, &lt;envar&gt;session_replication_role&lt;/envar&gt;</div><div><br></div><div>doc/adminguide/security.sgml</div><div>51:&lt;para&gt; set the session_replication_role to replica&lt;/para&gt;</div>
</div><div><br></div><div>The equivalent against 2.1 provides something rather more like 2.0, and sets the role to &quot;local&quot; appropriately.</div><div><br></div><div>Here&#39;s what&#39;s in 2.1:</div><div><br></div>
<div><div>cbbrowne@cbbrowne ~/P/s/src&gt; ack-grep session_replication_role</div><div>slonik/dbutil.c</div><div>166:                                            &quot;SET session_replication_role TO local; &quot;);</div><div>
<br></div><div>slon/remote_worker.c</div><div>386:                                            &quot;set session_replication_role = replica; &quot;,</div><div>1474:                                                                    &quot;set session_replication_role to local; &quot;</div>
<div>1543:                                                            &quot;set session_replication_role to replica; &quot;,</div><div>1566:                                                   if (archive_append_str(node, &quot;set session_replication_role to local;\n&quot;) &lt; 0)</div>
<div>1570:                                                   if (archive_append_str(node, &quot;set session_replication_role to replica;\n&quot;) &lt; 0)</div><div>5589:                            &quot;set session_replication_role to replica;\n&quot;</div>
<div><br></div><div>backend/slony1_funcs.sql</div><div>3360:           execute &#39;create temp table _slony1_saved_session_replication_role (</div><div>3362:           execute &#39;insert into _slony1_saved_session_replication_role</div>
<div>3364:                                   where name = &#39;&#39;session_replication_role&#39;&#39;;&#39;;</div><div>3366:                   execute &#39;set session_replication_role to local;&#39;;</div><div>3400:                   &#39;select setting from _slony1_saved_session_replication_role&#39; loop</div>
<div>3401:                   v_query := &#39;set session_replication_role to &#39; || v_row.setting;</div><div>3404:           execute &#39;drop table _slony1_saved_session_replication_role&#39;;</div><div><br></div><div>
slony_logshipper/parser.y</div><div>327:                                                    &quot;set session_replication_role to replica;&quot;) &lt; 0)</div><div><br></div><div>slony_logshipper/scan.l</div><div>135:session_replication_role { return K_SESSION_ROLE;   }</div>
</div><div><br></div><div>The relevant bits in 2.0 seem identical to 2.1.  (My ack-grep run finds the very same code.)</div><div><br></div><div>It seems to me that we should ensure we have a regression test that does both DDL and DML, to make sure that we process both properly, as that should work OK.</div>
</div>