-
Notifications
You must be signed in to change notification settings - Fork 390
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
Catch aggregate calls in constraints and indexes in ql compiler #7343
Conversation
be8773d
to
18638e5
Compare
5fa6dc7
to
74ac34e
Compare
74ac34e
to
10a7776
Compare
calls = ast.find_children(ir, irast.Call, flt, terminate_early=True) | ||
return next(iter(calls or []), None) |
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.
Does the bool
thing not actually work?
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.
Oh, you're trying to get the actual value, OK
edb/pgsql/compiler/expr.py
Outdated
elif irutils.is_singleton_set_of_call(expr): | ||
... |
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.
pass
is traditional for an empty branch
def is_singleton_set_of_call( | ||
call: irast.Call | ||
) -> bool: | ||
# Some set functions and operators are allowed in singleton mode | ||
# as long as their inputs are singletons | ||
|
||
return call.func_shortname in { | ||
sn.QualName('std', 'IN'), | ||
sn.QualName('std', 'NOT IN'), | ||
sn.QualName('std', 'EXISTS'), | ||
sn.QualName('std', '??'), | ||
sn.QualName('std', 'IF'), | ||
} |
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.
We could make this a new flag on operators that we configure in the standard library creation code. No sure if it is worth it, though?
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.
I initially was going to do that, but it seemed like a lot of machinery. I think it's probably the "correct" thing to do in the long run.
tests/test_edgeql_ddl.py
Outdated
'set returning operator std::DISTINCT is not supported ' | ||
'in singleton expressions'): | ||
edgedb.SchemaDefinitionError, | ||
"cannot use aggregate operator 'std::DISTINCT' " |
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.
we should say "SET OF operator", not "aggregate operator"
'operator' | ||
) | ||
op_name = str(set_of_op.func_shortname) | ||
raise errors.UnsupportedFeatureError( |
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.
We should say SET OF instead of aggregate.
Also, I know I wrote the original error message, but I have no idea what "non-aggregating constraint" means, so we should stop saying it. :P
473d322
to
19c3fcf
Compare
related #7264
Given the schema:
The following error is produced: