Repository navigation
Add startup options parameter to ReplicationConfig - #10
Merged
Merged
Conversation
The startup parameter list sent in worker::startup() was previously fixed (user, database, replication, client_encoding, application_name) with no way to set libpq's `options` parameter, and no way to issue a SET after connecting either. PostgreSQL honors `options` on replication connections the same as on ordinary ones (verified with `PGOPTIONS='-c timezone=UTC -c intervalstyle=iso_8601' pg_recvlogical`, which changed the walsender's rendered output as expected), so this was a real, fixable gap rather than a protocol limitation. Add `ReplicationConfig::options: Option<String>` (named to match tokio_postgres::Config::options) plus a `with_options()` builder, and thread it into the startup parameter list, only including the `options` key when it's `Some`. This lets callers pin session GUCs (DateStyle, IntervalStyle, etc.) on the replication connection the same way they already can on a normal libpq connection, so decoded WAL text agrees byte-for-byte with text rendered by a separately-configured connection pool. Docker isn't available in the environment this was developed in, so this adds unit tests proving the startup parameter list includes `options` when set and omits it when unset, rather than a full testcontainers-based integration test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Owner
|
hey, other than that, all good! |
Contributor
Author
|
Thanks for the quick feedback. I pushed an additional commit that updates the README with a 1-liner description. |
vnvo
approved these changes
Sep 21, 2026
Owner
|
merged --> 0.4.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to set some connection level configs like
timezoneandintervalstyle, so I can reliably predict the exact byte-encoding I'll receive for values like timestamps and intervals.ReplicationConfig::options: Option<String>(named to match tokio_postgres::Config::options) plus awith_options()builder, and thread it into the startup parameter list, only including theoptionskey when it'sSome. This lets callers pin session GUCs (DateStyle, IntervalStyle, etc.) on the replication connection the same way they already can on a normal libpq connection, so decoded WAL text agrees byte-for-byte with text rendered by a separately-configured connection pool.I'm pretty new to rust development, so I'm more than happy to address any feedback you have and iterate on the solution if you're open to this PR.