Add SQL builder utilities for PostgreSQL replication management#65
Add SQL builder utilities for PostgreSQL replication management#65
Conversation
- Introduced a new module `sql_builder` containing functions for building SQL statements related to replication slots and subscriptions. - Implemented quoting functions for identifiers and string literals to prevent SQL injection. - Added SQL builders for creating, altering, dropping, and managing replication slots and subscriptions. - Included tests for all new functionalities to ensure correctness and prevent regressions. - update SQL generation for START_REPLICATION to remove unnecessary parentheses and add null byte checks in quoting functions - simplify SQL command construction in sql_builder.rs rel v0.6.3
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
==========================================
+ Coverage 93.74% 94.40% +0.65%
==========================================
Files 10 11 +1
Lines 14364 15251 +887
==========================================
+ Hits 13466 14398 +932
+ Misses 898 853 -45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request updates the crate version to 0.6.3 and introduces a centralized sql_builder module to handle SQL statement construction for replication commands. Both libpq and native connection implementations are refactored to use this module, which incorporates null byte validation to mitigate SQL injection risks. Feedback is provided to optimize string buffer allocations in the quote_ident and quote_literal functions by accounting for character escaping, which prevents unnecessary reallocations.
sql_buildercontaining functions for building SQL statements related to replication slots and subscriptions.rel v0.6.3