-
Notifications
You must be signed in to change notification settings - Fork 389
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
Coalesce DML express return more than one Element #6438
Comments
I notice there are serveral bug of Coalesce DML are fixed recently. Is this possible be fixed together? Thanks. |
Fascinatingly, I think the bug here is actually in
Then both of these fail spuriously:
|
You can probably work around the issue by doing |
There are a number of places that improperly handle a set that has multiple NULL values in it: * INSERT on single values * UPDATE on single values * assert_single The assert_single case is a long standing bug that can be triggered without much trouble. The INSERT/UPDATE bugs are new, and stem from the new ?? on DML, since I think it that was the first thing in the compiler backend where extra NULLS might be produced for something with single cardinality. Fix this by adding null checks at the consumer sites. One of the consumer sites is set_as_subquery, and I modified update to always use that. I also added a helper function to add the null checks, and I'll be going back and changing lots of other code to use the helper. We could also flip this around a bit and try saying that we shouldn't ever produce extra NULLs in a single set, and try to stamp it out on the producer side, though that seems a little less consistent to me? Fixes #6438.
Great done.
Yes, but it must following
|
There are a number of places that improperly handle a set that has multiple NULL values in it: * INSERT on single values produced by ?? * UPDATE on single values produced by ?? * assert_single * limit/offset The assert_single and limit case is a long standing bug that can be triggered without much trouble. The INSERT/UPDATE bugs are new, and stem from the new ?? on DML, since I think it that was the first thing in the compiler backend where extra NULLS might be produced for something with single cardinality. Fix the long-standing cases by adding null checks, but fix the coalesce cases by adding a null check at the producer side. The rule then, is that there can be NULLs in any produced set that can be empty, but a single set has to return at most one row (so it can't have extra NULLs). Fixes #6438.
Yup that was also a bug :(. Fixed in #5690 too. |
There are a number of places that improperly handle a set that has multiple NULL values in it: * INSERT on single values produced by ?? * UPDATE on single values produced by ?? * assert_single * limit/offset The assert_single and limit case is a long standing bug that can be triggered without much trouble. The INSERT/UPDATE bugs are new, and stem from the new ?? on DML, since I think it that was the first thing in the compiler backend where extra NULLS might be produced for something with single cardinality. Fix the long-standing cases by adding null checks, but fix the coalesce cases by adding a null check at the producer side. The rule then, is that there can be NULLs in any produced set that can be empty, but a single set has to return at most one row (so it can't have extra NULLs). Fixes #6438.
@msullivan #5690 is like a typo fix. Are you link a wrong issue? |
There are a number of places that improperly handle a set that has multiple NULL values in it: * INSERT on single values produced by ?? * UPDATE on single values produced by ?? * assert_single * limit/offset The assert_single and limit case is a long standing bug that can be triggered without much trouble. The INSERT/UPDATE bugs are new, and stem from the new ?? on DML, since I think it that was the first thing in the compiler backend where extra NULLS might be produced for something with single cardinality. Fix the long-standing cases by adding null checks, but fix the coalesce cases by adding a null check at the producer side. The rule then, is that there can be NULLs in any produced set that can be empty, but a single set has to return at most one row (so it can't have extra NULLs). Fixes #6438.
1.defind schema
2.insert Foo
let's simply edgedb to show more exactly by removing array.
modify edgedb to
Here is error
While I run
It did return only one element.
If I change id of Bar to one of id has existed in database, it will run correctly without this bug.
The text was updated successfully, but these errors were encountered: