Hi all
Attached is a patch against 9.6 to add support for informing logical decoding plugins of the new sequence last_value when sequence advance WAL records are processed during decoding.
The primary purpose is to make logical replication based failover practical in 9.6 by ensuring that the downstream's sequence positions are always ahead of the upstream's. It's replicating the crash-recovery sequence positions, basically.
This isn't as flexible as a full sequence access method but it's simple, unintrusive and it gets things done now.
test_decoding is updated to reflect the change and test the functionality. The large diff is mainly a result of that, since the output is a bit spammy.