defradb
defradb copied to clipboard
One-many self joins fail without explicit `@primary` directive
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.