Skip to content

Add SQL builder utilities for PostgreSQL replication management#65

Merged
isdaniel merged 1 commit intomainfrom
chore/sql-builder-improve
May 4, 2026
Merged

Add SQL builder utilities for PostgreSQL replication management#65
isdaniel merged 1 commit intomainfrom
chore/sql-builder-improve

Conversation

@isdaniel
Copy link
Copy Markdown
Owner

@isdaniel isdaniel commented May 4, 2026

  • 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

- 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
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.40%. Comparing base (b738aef) to head (6eaeae5).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/sql_builder.rs
Comment thread src/sql_builder.rs
@isdaniel isdaniel merged commit 07d3681 into main May 4, 2026
19 checks passed
@isdaniel isdaniel deleted the chore/sql-builder-improve branch May 4, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant