Skip to content

Fix prefetched scalar decoding precedence - #1877

Open
XX-Q wants to merge 1 commit into
groue:developmentfrom
XX-Q:codex/fix-prefetched-scalar-decoding-1804
Open

Fix prefetched scalar decoding precedence#1877
XX-Q wants to merge 1 commit into
groue:developmentfrom
XX-Q:codex/fix-prefetched-scalar-decoding-1804

Conversation

@XX-Q

@XX-Q XX-Q commented Aug 8, 2026

Copy link
Copy Markdown

Fixes #1804.

Prefetched association elements were always decoded through Decodable, even when their database-specific conformances should take precedence. This made values such as UUID-backed DatabaseValueConvertible types fail when fetched from a single selected column.

This change:

  • prefers FetchableRecord.init(row:) over Decodable for prefetched rows;
  • uses the existing ColumnDecoder paths for Data, Date, DatabaseValueConvertible, and StatementColumnConvertible values;
  • keeps ordinary row-based Decodable decoding as the fallback;
  • adds regression coverage for both precedence rules.

Validation:

  • swift build passes.
  • A standalone reproduction of the UUID/MedalID case now passes.
  • A standalone reproduction confirms FetchableRecord.init(row:) is selected over Decodable.
  • The XCTest suite could not be run locally because this machine only has Command Line Tools and its Swift toolchain reports no such module XCTest; the added tests are intended to run in CI.

Pull Request Checklist

  • CONTRIBUTING: I have read the contribution guidelines.
  • BRANCH: This pull request targets development.
  • DOCUMENTATION: Inline documentation has been updated. (Not applicable: internal bug fix with no API change.)
  • DOCUMENTATION: README.md or another dedicated guide has been updated. (Not applicable: internal bug fix with no API change.)
  • TESTS: Changes are tested with regression tests and standalone reproductions.
  • TESTS: make smokeTest runs without failure. (Not run: full Xcode is unavailable locally.)

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