ITADN

@Selection field name is incorrect within update

#232Closedrcarver 创建于 2025-11-14
bug
R
rcarvercommented
### Description When reading the name of a field during an update, the field name uses the selection's name, not the root table name. Here's a test that should show it: ```swift @Test func updatesOnSelection() { assertQuery( Root.update { $0.field.updateSelf() } ) // UPDATE "roots" // SET "one" = "fields"."one" ❌ } @Table struct Root { @Columns var field: Field } @Selection struct Field { var one: Int } extension Updates<Field> { mutating func updateSelf() { self.one = self.one } } ``` Side note: I can't run tests or would have taken a try to PR already: ``` swift-structured-queries/Tests/StructuredQueriesMacrosTests/BindMacroTests.swift:2:8: error: missing required module 'SwiftCompilerPlugin' 1 | import MacroTesting 2 | import StructuredQueriesMacros | `- error: missing required module 'SwiftCompilerPlugin' 3 | import Testing ``` ### Checklist - [ ] I have determined whether this bug is also reproducible in a vanilla SwiftUI project. - [x] If possible, I've reproduced the issue using the `main` branch of this package. - [x] This issue hasn't been addressed in an [existing GitHub issue](https://github.com/pointfreeco/swift-structured-queries/issues) or [discussion](https://github.com/pointfreeco/swift-structured-queries/discussions). ### Expected behavior _No response_ ### Actual behavior _No response_ ### Reproducing project _No response_ ### Structured Queries version information f035565a8e4aeb18a939f1fd025c1257303094dd ### Destination operating system _No response_ ### Xcode version information Version 26.1 (17B55) ### Swift Compiler version information ```shell swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1) Target: arm64-apple-macosx15.0 ```
关闭于 2025-12-22 3 条评论