-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Hasura 2.0: cannot insert NULL on nullable column (specifically for nested inserts) #7484
Comments
In 2.0, we introduced not allowing We also introduced a flag: Unfortunately, the only solution is to rewrite the query as so:
|
Hi @tirumaraiselvan thanks for you response. Good to know the Your suggested query did not work either as in this case,
One thing that works is removing
But then in the code, we are forced to maintain two separate queries. |
Ah, sorry. I thought you wanted to insert a relationship row as well. So, basically you want one query which inserts a parent row and optionally children rows. One workaround is to make the the @nicuveo Any thoughts here? |
Sorry for the delay! Nope, this is not directly related to the boolean collapse: that was simply an oversight during the work towards 2.0 (see below for an detailed explanation). I have a fix, internally; it will be merged soon, and will hopefully be part of the next release, I'll let you know ASAP. Ok, now, for the behind-the-scenes details. The GraphQL spec distinguishes between implicit and explicit null values: it's not the same thing, semantically, to omit the value, or to explicitly give it When we rewrote the schema generation code and its corresponding input parsers, we made the field for nested inserts optional: the field is nullable in the schema, the relationship can be omitted; but we forgot to make it internally nullable, meaning we erroneously reject explicit null values. The difference can be seen in the following snippet: graphql-engine/server/src-lib/Hasura/GraphQL/Schema/Mutation.hs Lines 138 to 146 in e919c41
in the case of array relationships, the parser is correctly constructed with |
This was automatically closed when the fix was submitted: it will be part of the next release! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@tokestermw @1018715564 both of you encountered the boolean collapse behavior mentioned earlier in this issue. Hiding your messages as off-topic |
Hi, say we have a table A
and table B
w/ foreign keys
and add a relationship called
relationship
Now since
related_id
is nullable, we should be able to insertI am getting the following error
This error does not happen on Hasura 1.3.3.
I wonder if it's related nested inserts (https://hasura.io/docs/latest/graphql/core/databases/postgres/mutations/insert.html#nested-inserts). I also didn't find anything in the release notes for Hasura 2.0.
Thanks
The text was updated successfully, but these errors were encountered: