model-writtenrun 7385 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Mark Dilger opened the thread with a test demonstrating that a subscriber-side statement trigger on replicated TRUNCATE caused an assertion because execution lacked both an active portal and a snapshot #1.
- Tom Lane diagnosed pre-existing unsafe execution of user code without a snapshot and raised creating a portal as possible broader work; Mark also described missing privilege checks, which Tom treated as a separate concern #2 #3 #4.
- Tom proposed either wrapping ExecuteTruncateGuts alone or maintaining a snapshot throughout each replication step, and Amit Kapila favored the broader policy to reduce future mistakes #4 #5.
- Tom implemented paired begin/end helpers that manage snapshots and command-counter increments, accepting some extra work for stream-control messages; Mark confirmed that the reproducer passed with this patch #6 #7.
- While examining the fix, Tom and Mark identified assertions that trusted incoming stream-control messages and transaction IDs, leading to agreement that these needed runtime error checks #6 #7 #8 #9.
- The snapshot fix from #6 landed as 3a09d75b4f with only helper renaming and backports through PostgreSQL 11; the attached reproducer was not included.
- Tom then posted a separate protocol-validation patch, and Amit questioned inconsistent use of elog versus ereport; they also agreed that protocol-violation messages could be non-translatable #10 #11 #12 #13.
- Tom committed an expanded version as fe6a20ce54, adding further input checks and hash-table corrections while standardizing protocol errors on non-translatable messages, and explained that rereading the code had exposed more unsafe assertions #14.
- The thread ended with Alvaro Herrera endorsing the translation decision after both fixes had landed; the broader portal and privilege-checking ideas had no implementation in this thread #15.