Skip to content

One-many self joins fail without explicit @primary directive #2620

Closed

Description

For example, this SDL works:

type User {
  boss: User @primary
  minions: [User]
}

However, this returns an error:

type User {
  boss: User
  minions: [User]
}

relation missing field. Object: User, RelationName: user_user. Stack: /home/andy/Projects/Source/defradb/internal/db/errors.go:620 (0x1c13b7d)
NewErrRelationMissingField: return errors.New(
/home/andy/Projects/Source/defradb/internal/db/collection.go:760 (0x1bfc8d8)
validateSecondaryFieldsPairUp: return NewErrRelationMissingField(underlying, field.RelationName.Value())
/home/andy/Projects/Source/defradb/internal/db/collection.go:683 (0x1bf7e5b)

Note: one-ones are fine, as they have to be declared with an @primary directive on one side anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area/schemaRelated to the schema systembugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions