-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disallow uid as a predicate name. #4219
Conversation
uid is used internally to report the UIDs of the nodes in Dgraph. Users should get an error when trying to add a predicate of that name to the schema or when sending mutations with uid as a predicate. This PR enables checks for those situations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ A review job has been created and sent to the PullRequest network.
@martinmr you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✖️ This code review was cancelled. See Details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @manishrjain)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @manishrjain and @martinmr)
worker/draft.go, line 255 at r1 (raw file):
for attr, storageType := range schemaMap { if _, err := schema.State().TypeOf(attr); err != nil {
do we need any explicit error checking? createSchema if this error
worker/mutation.go, line 210 at r1 (raw file):
return err } if err := updateSchema(&s); err != nil {
Just return updateSchema(&s)
x/keys.go, line 565 at r1 (raw file):
// predicate is a predicate that has a special meaning in Dgraph and its query // language and should not be allowed as a user-defined predicate. var internalPredicateMap = map[string]struct{}{
where predicates are populated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @balajijinnah and @manishrjain)
worker/draft.go, line 255 at r1 (raw file):
Previously, balajijinnah (balaji) wrote…
do we need any explicit error checking? createSchema if this error
I changed the return value of createSchema so I changed the code here to check for that error.
worker/mutation.go, line 210 at r1 (raw file):
Previously, balajijinnah (balaji) wrote…
Just
return updateSchema(&s)
Done.
x/keys.go, line 565 at r1 (raw file):
Previously, balajijinnah (balaji) wrote…
where predicates are populated?
Right here. This is meant to act as a constant. The map should not modified. If another predicate (let's say _predicate_
is deemed as an internal predicate, it should be added here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 5 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @balajijinnah and @manishrjain)
uid is used internally to report the UIDs of the nodes in Dgraph. Users
should get an error when trying to add a predicate of that name to the
schema or when sending mutations with uid as a predicate.
This PR enables checks for those situations.
This change is