Skip to content
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

Fix the leading dot notation in inserts #5142

Merged
merged 24 commits into from
May 17, 2023
Merged

Conversation

zchenb
Copy link
Contributor

@zchenb zchenb commented Mar 8, 2023

Fixes #4958

@msullivan
Copy link
Member

The problem is that while we wanted to disallow these leading dots in the expression itself, we do now allow them in defaults

@zchenb
Copy link
Contributor Author

zchenb commented Mar 15, 2023

So I am not sure whether the following would make sense:

Given the schema

type A { required property  b := "hello"; required property  c := .b; required a : str; required d : str}

The following two represent potentially good insert queries:

  1. Inserting with properties set to defaults:
insert A { a := .b, d := .c};
  1. Inserting with properties set to another property:
insert A {a := "world", d := .a}

Both queries are currently allowed.

Obviously, we would like to ban queries like insert A { a := .a}, but it is currently unclear to me how to describe this subset. As obviously, by the same logic, insert A {a := .d, d := .a} is not allowed but insert A { a := .d, d := .c} is allowed.

@zchenb
Copy link
Contributor Author

zchenb commented Mar 15, 2023

The current semantics seems to be that, all properties have defaults being the empty set unless otherwise specified. Inserts are really inserting the object after applying the insert shape to the default object. That is, insert A {S} is really inserting default(A) {S}.

@zchenb zchenb marked this pull request as ready for review May 12, 2023 01:12
@zchenb
Copy link
Contributor Author

zchenb commented May 12, 2023

This PR is ready for merge!

@zchenb zchenb requested a review from msullivan May 12, 2023 16:31
Copy link
Member

@msullivan msullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks.

edb/edgeql/compiler/viewgen.py Outdated Show resolved Hide resolved
@zchenb zchenb merged commit e392d71 into master May 17, 2023
22 checks passed
@zchenb zchenb deleted the zc/insert_leading_dot_fix branch May 17, 2023 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leading dot notation should not appear in insert shapes
2 participants