Did some further tests on the problem I saw and I see that it does not have anything to do with this patch. I picked code from top of head. If I have enough changes in a transaction to initiate streaming, then it will also stream the same changes after a commit.
BEGIN; INSERT INTO stream_test SELECT repeat('a', 10) || g.i FROM generate_series(1,800) g(i); SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL,NULL, 'two-phase-commit', '1', 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1'); ** see streamed output here ** END; SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL,NULL, 'two-phase-commit', '1', 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1'); ** see the same streamed output here ** I think this is because since the transaction has not been committed, SnapBuildCommitTxn is not called which is what moves the "builder->start_decoding_at", and as a result later calls to pg_logical_slot_get_changes will start from the previous lsn. I did do a quick test in pgoutput using pub/sub and I dont see duplication of data there but I haven't verified exactly what happens. regards, Ajin Cherian Fujitsu Australia