Skip to content

Fix Missing Connection Metadata - #232

Open
0xTim wants to merge 5 commits into
mainfrom
missing-connection-id
Open

0xTim wants to merge 5 commits into
mainfrom
missing-connection-id

Conversation

@0xTim

@0xTim 0xTim commented Sep 24, 2026

Copy link
Copy Markdown
Member

Resolves #230

The only metadata that is set in the stack is the connection ID, so make sure we copy that over into a new logger. Can't do the other way around in case we pollute other loggers. I'll be glad when we can remove all these hacks and just use task locals...

@0xTim
0xTim requested a review from gwynne as a code owner September 24, 2026 15:19
@0xTim 0xTim added the semver-patch Internal changes only label Sep 24, 2026
@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.09%. Comparing base (26fe819) to head (4e64aa3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #232      +/-   ##
==========================================
+ Coverage   64.36%   65.09%   +0.72%     
==========================================
  Files          12       12              
  Lines         609      616       +7     
==========================================
+ Hits          392      401       +9     
+ Misses        217      215       -2     
Files with missing lines Coverage Δ
...tPostgresDriver/FluentPostgresClientDatabase.swift 88.34% <100.00%> (+0.34%) ⬆️
.../FluentPostgresDriver/FluentPostgresDatabase.swift 70.49% <100.00%> (+5.57%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptoffy ptoffy left a comment

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.

We should not be using PostgresDatabase anymore

Comment thread Sources/FluentPostgresDriver/FluentPostgresDatabase.swift Outdated
Comment thread Sources/FluentPostgresDriver/FluentPostgresClientDatabase.swift Outdated
let encodingContext: PostgresEncodingContext<E>
let decodingContext: PostgresDecodingContext<D>
let inTransaction: Bool
let connection: PostgresConnection?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We had to add this to avoid a crash in withConnection in a transaction

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.

We don't need this, Sorry, I was on mobile and misread. Only the FluentPostgresClientDatabase should use the new .sql method taking a logger. The current FluentPostgresDatabase can stay as it is, with the new major it will be deprecated along with PostgresDatabase

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Internal changes only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: psql_connection_id missing from logs in 2.13.1

2 participants