Skip to content

Cannot reference multiple tables #110

Closed

Description

@clive819

Description

This doesn't compile

@Table struct A {

    // ✅
    var single: B.ID

    // ❌
    var array: [B.ID]

    // ❌
    var dictionary: [B.ID: Double]
}

@Table struct B: Identifiable {

    let id: UUID
}

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • I have determined whether this bug is also reproducible in a vanilla GRDB 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

The code should compile

Actual behavior

Image

Reproducing project

No response

SharingGRDB version information

No response

Sharing version information

No response

GRDB version information

No response

Destination operating system

No response

Xcode version information

Version 16.2 (16C5032a)

Swift Compiler version information

Activity

  1. mbrandonw commented on Jul 28, 2025

    @mbrandonw
    Member

    Hi @clive819, the array and dictionary fields of your type are not types that can be natively stored in SQLite. You must perform an extra step to describe how to transform these types into something that SQLite does understand. This is documented here.

    Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there!

  2. locked and limited conversation to collaborators on Jul 28, 2025
  3. converted this issue into a discussion #111 on Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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