Skip to content

Fix handling of array bindings containing optional values#279

Merged
gwynne merged 2 commits into
mainfrom
arrays-will-null-values
Jul 18, 2026
Merged

Fix handling of array bindings containing optional values#279
gwynne merged 2 commits into
mainfrom
arrays-will-null-values

Conversation

@gwynne

@gwynne gwynne commented Jul 18, 2026

Copy link
Copy Markdown
Member

These changes are now available in 2.16.0

  • Now requires Swift 6.1
  • We now use SQLKit's SomeCodingKey instead of redefining it.
  • Encoding of nil binds to NULL is now on the fastest possible path instead of the slowest.
  • Values that conform to Postgres[Throwing]DynamicTypeEncodable but not Postgres[NonThrowing]Encodable are now handled on the fast path.
  • nil values in bound arrays having optional element types (which they should, as all arrays in Postgres have NULLable values) are now handled correctly instead of causing crashes.

gwynne added 2 commits July 18, 2026 12:35
…values on an extreme fast-path instead of the slowest path. Support values conforming to Postgres[Throwing]DynamicTypeEncodable but not PostgresEncodable. Correctly handle nil values in arrays with optional element types.
@gwynne gwynne added bug Something isn't working semver-minor Contains new APIs labels Jul 18, 2026
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.37%. Comparing base (e4f9052) to head (b772d81).

Files with missing lines Patch % Lines
Sources/PostgresKit/PostgresDataTranslation.swift 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #279      +/-   ##
==========================================
+ Coverage   42.84%   43.37%   +0.53%     
==========================================
  Files          13       13              
  Lines         852      853       +1     
==========================================
+ Hits          365      370       +5     
+ Misses        487      483       -4     
Files with missing lines Coverage Δ
Sources/PostgresKit/PostgresDataTranslation.swift 70.37% <80.00%> (+1.59%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread README.md
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift60up.svg" alt="Swift 6.0+"></a>
</p>

[![Documentation](https://design.vapor.codes/images/readthedocs.svg)](https://docs.vapor.codes/4.0/)

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 can point to the API docs if that's better

@gwynne
gwynne merged commit a8ce958 into main Jul 18, 2026
17 checks passed
@gwynne
gwynne deleted the arrays-will-null-values branch July 18, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working semver-minor Contains new APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants