Skip to content

Add PostgresConnection based SQLDatabase - #284

Merged
ptoffy merged 6 commits into
mainfrom
postgresconnection-sqldatabase
Sep 24, 2026
Merged

ptoffy merged 6 commits into
mainfrom
postgresconnection-sqldatabase

Conversation

@ptoffy

@ptoffy ptoffy commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

These changes are now available in 2.17.0

If we have a PostgresConnection (which we'll do after vapor/fluent-postgres-driver#227) we can use that as SQLDatabase without having to go through PostgresDatabase

@ptoffy
ptoffy requested a review from gwynne as a code owner September 22, 2026 11:15
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.35%. Comparing base (6859275) to head (4b631e9).

Files with missing lines Patch % Lines
...urces/PostgresKit/PostgresConnectionDatabase.swift 95.12% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #284      +/-   ##
==========================================
+ Coverage   45.90%   46.35%   +0.44%     
==========================================
  Files          13       14       +1     
  Lines         891      932      +41     
==========================================
+ Hits          409      432      +23     
- Misses        482      500      +18     
Files with missing lines Coverage Δ
...urces/PostgresKit/PostgresConnectionDatabase.swift 95.12% <95.12%> (ø)

... and 1 file with indirect coverage changes

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

}


private struct LogRecorder: LogHandler {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets pull in the one from Swift Log for testing

@gwynne

gwynne commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Does this offer any significant concrete benefit? Other than making it easier to deprecate PostgresDatabase.

@ptoffy

ptoffy commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

@gwynne well we can use the connection's a/a interface in execute(sql:_) so we avoid hopping through the EventLoop

@gwynne

gwynne commented Sep 23, 2026

Copy link
Copy Markdown
Member

Plus saving on the overhead of the pointless dispatch through the existential for the protocol. Still, I'm curious whether there's any significant performance improvement. I wish this package had benchmarks.

Comment thread .github/workflows/test.yml Dismissed
@gwynne gwynne added the semver-minor Contains new APIs label Sep 23, 2026
@ptoffy
ptoffy merged commit 139b0c4 into main Sep 24, 2026
18 checks passed
@ptoffy
ptoffy deleted the postgresconnection-sqldatabase branch September 24, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor Contains new APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants