Skip to content

'fetchAll' is only available in iOS 17 or newer for tuple selections #227

Description

@mertalev

Description

The query builder doesn't allow selecting tuples unless I increase the iOS requirement to iOS 17, which seems rather arbitrary rather than an actual limitation. The minimum iOS version in my project is 14.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

Given that it can select all columns or one column, the API for selecting some columns should not have different version requirements.

Actual behavior

Any tuple output type results in the version requirement increasing to iOS 17, while other parts of the API do not require this version.

Reproducing project

Given the table:

@Table
struct Asset {
  let id: String
  let foo: Bool
  let bar: Bool
}

Compilation fails if I try to query it as such:

let foo = try await db.read { conn in
  return try Asset.select { ($0.foo, $0.bar) }.fetchAll(conn) // `'fetchAll' is only available in iOS 17 or newer`
}

Selecting one column works, as does selecting self:

let ids = try await db.read { conn in
  return try Asset.select(\.id).fetchAll(conn)
}

let assets = try await db.read { conn in
  return try Asset.select(\.self).fetchAll(conn)
}

Interestingly, selecting one column doesn't work either for returning:

let ids = try await db.read { conn in
  return try Asset.update { $0.foo = ""}.returning(\.id).fetchAll(conn) // `'fetchAll' is only available in iOS 17 or newer`
}

let assets = try await db.read { conn in
  return try Asset.update { $0.foo = ""}.returning(\.self).fetchAll(conn) // works
}

Structured Queries version information

0.25.2 (sqlite-data is 1.3.0)

Destination operating system

iOS 26.1

Xcode version information

Version 26.0.1 (17A400)

Swift Compiler version information

swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx26.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions