-
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
Fatal error (sintax error) after upgrading from 2.5.1 to 2.6.1 on insert mutation #8475
Comments
I am able to trivially reproduce the issue. Give the following table: CREATE TABLE test (
id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
); And the following mutation: mutation Test {
insert_test(objects: [{}]) {
affected_rows
}
} We would expect to insert a row with the default value for an id, instead we get a syntax error. Explanation: the older hasura behavior was to explicitly insert INSERT INTO test (id) VALUES (DEFAULT); But this would often be very verbose, especially if input was only required for some columns. INSERT INTO test () VALUES (); Which is not valid SQL. |
Well isn't the expected behavior to add default if no value is supplied? I am using default a lot and now it is not working anymore. I see issue #8443 could be related but it is marked as fixed in 2.6.1 while I do have a problem. |
@GiamBoscaro thanks for raising this bug report. The team's working on a fix as we speak and we'll update here as soon as it's released. |
Oh ok, so it is a bug. I will wait for the next release then. Best regards! |
I can confirm this regression is introduced in 2.5.2. 2.5.1 works fine. |
Thanks for your patience! The fix for this regression is available from release |
@sassela from v2.7.0 (and possibly v2.6.2) passing more than one empty object results in a single record. On v2.6.0 it inserted two records. Is a single record the expected functionality or is that a bug? Mutation: mutation InsertLabels {
insert_labels(objects: [{}, {}]) {
returning {
id
}
}
} Result: {
"data": {
"insert_labels": {
"returning": [
{
"id": "37980050-f057-4f5a-9057-bb3454896bfc",
}
]
}
}
} |
@joserocha3 can reproduce, this is a bug. Thank you for bringing it to our attention. INSERT INTO table_name DEFAULT VALUES RETURNING * To cover this case. The above works for a single row, but not multiple. INSERT INTO table_name VALUES (DEFAULT), (DEFAULT) RETURNING * |
@BenoitRanque thank you so much for confirming! Is a fix something we can expect to see soon? |
@joserocha3 thank you for reporting the issue. I'm picking this up again. Hope to get a fix out soon. |
A fix has been merged via ae0dae0 and will be available in the next release. In the meantime, you can try it out using the Docker image: |
Version Information
Server Version:
2.6.1
Environment
Ubuntu 20
What is the expected behaviour?
Query should be working normally
Keywords
Fatal error, syntax error )
What is the current behaviour?
Getting fatal error
How to reproduce the issue?
Please provide any traces or logs that could help here.
Any possible solutions?
No idea
Can you identify the location in the source code where the problem exists?
Syntax error in insert query
If the bug is confirmed, would you be willing to submit a PR?
Do not have the knowledge to fix and pr
The text was updated successfully, but these errors were encountered: