<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 "local".</div>
<div><br></div><div>In effect, what'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's the code in both 2.0 and 2.1 branches. (See src/backend/remote_worker.c, look for the case statement processing "DDL_SCRIPT".)</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'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> ack-grep session_replication_role</div><div>src/slonik/dbutil.c</div><div>166: "SET session_replication_role TO local; ");</div>
<div><br></div><div>src/slon/remote_worker.c</div><div>353: "set session_replication_role = replica; ");</div><div>4958: "set session_replication_role to replica;\n"</div>
<div><br></div><div>src/slony_logshipper/parser.y</div><div>327: "set session_replication_role to replica;") < 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='replica';</div><div><br></div><div>doc/adminguide/triggers.sgml</div>
<div>23:<para> A new GUC variable, <envar>session_replication_role</envar></div><div><br></div><div>doc/adminguide/security.sgml</div><div>51:<para> set the session_replication_role to replica</para></div>
</div><div><br></div><div>The equivalent against 2.1 provides something rather more like 2.0, and sets the role to "local" appropriately.</div><div><br></div><div>Here's what's in 2.1:</div><div><br></div>
<div><div>cbbrowne@cbbrowne ~/P/s/src> ack-grep session_replication_role</div><div>slonik/dbutil.c</div><div>166: "SET session_replication_role TO local; ");</div><div>
<br></div><div>slon/remote_worker.c</div><div>386: "set session_replication_role = replica; ",</div><div>1474: "set session_replication_role to local; "</div>
<div>1543: "set session_replication_role to replica; ",</div><div>1566: if (archive_append_str(node, "set session_replication_role to local;\n") < 0)</div>
<div>1570: if (archive_append_str(node, "set session_replication_role to replica;\n") < 0)</div><div>5589: "set session_replication_role to replica;\n"</div>
<div><br></div><div>backend/slony1_funcs.sql</div><div>3360: execute 'create temp table _slony1_saved_session_replication_role (</div><div>3362: execute 'insert into _slony1_saved_session_replication_role</div>
<div>3364: where name = ''session_replication_role'';';</div><div>3366: execute 'set session_replication_role to local;';</div><div>3400: 'select setting from _slony1_saved_session_replication_role' loop</div>
<div>3401: v_query := 'set session_replication_role to ' || v_row.setting;</div><div>3404: execute 'drop table _slony1_saved_session_replication_role';</div><div><br></div><div>
slony_logshipper/parser.y</div><div>327: "set session_replication_role to replica;") < 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>