Refactor SQL quoting and replication stream handling - #114
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
==========================================
+ Coverage 94.80% 94.98% +0.18%
==========================================
Files 27 27
Lines 21285 21891 +606
==========================================
+ Hits 20179 20794 +615
+ Misses 1106 1097 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
isdaniel
force-pushed
the
chore/review
branch
from
September 13, 2026 07:17
6f38ed5 to
d6db5ef
Compare
- Introduced `QuoteStyle::ReplicationLiteral` to handle quoting for replication commands, ensuring that backslashes are treated as ordinary characters and single quotes are doubled.
- Updated `quote_replication_literal` function to correctly quote string literals for replication commands, avoiding the escape-string form and ensuring safety against SQL injection.
- Modified `build_start_replication_sql` and `build_base_backup_sql` to use `quote_replication_literal` for quoting options, ensuring correct SQL syntax for replication commands.
- Enhanced documentation for quoting functions to clarify behavior differences between SQL and replication contexts.
- Improved handling of LSN (Log Sequence Number) in `LogicalReplicationStream`, ensuring that reconnections use the correct applied position and that feedback is sent appropriately.
- Updated `BaseBackupOptions` struct to ensure default values match server expectations, preventing silent failures in backup options.
- Added tests to verify correct behavior of LSN parsing and timestamp conversion, ensuring robustness against edge cases.
refactor(lsn): accept `impl Into<Lsn>` in the feedback setters
Every example ended its handler with the same wart:
event_stream.update_applied_lsn(event.lsn.value());
`ChangeEvent.lsn` is an `Lsn`, but the setters took a raw `XLogRecPtr`,
so acking the position you were just handed required unwrapping it. All
six examples carried that `.value()`.
Widen `update_applied_lsn` / `update_flushed_lsn` (on both
`SharedLsnFeedback` and the `EventStream` wrappers) to `impl Into<Lsn>`
and normalise once inside. `From<u64> for Lsn` already exists, so every
existing `u64` call site still compiles — this is additive, not a break.
Monomorphised, so the hot path is unchanged.
isdaniel
force-pushed
the
chore/review
branch
from
September 13, 2026 08:37
80fdb59 to
69282d2
Compare
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.
QuoteStyle::ReplicationLiteralto handle quoting for replication commands, ensuring that backslashes are treated as ordinary characters and single quotes are doubled.quote_replication_literalfunction to correctly quote string literals for replication commands, avoiding the escape-string form and ensuring safety against SQL injection.build_start_replication_sqlandbuild_base_backup_sqlto usequote_replication_literalfor quoting options, ensuring correct SQL syntax for replication commands.LogicalReplicationStream, ensuring that reconnections use the correct applied position and that feedback is sent appropriately.BaseBackupOptionsstruct to ensure default values match server expectations, preventing silent failures in backup options.