-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
Description
If we try to update a column through an update mutation using multiple (> 1) operators, then it results in Postgres query error.
For a simple article table:-
Query:
mutation {
update_article(
_set: {id: 1}
_inc: {id: 2}
where: {author_id: {_eq: 1}}
){
affected_rows
}
}Response:
{
"errors": [
{
"extensions": {
"internal": {
"statement": "WITH \"public_article__mutation_result_alias\" AS (UPDATE \"public\".\"article\" SET \"id\" = $1,\"id\" = (\"id\"+('2')::integer) WHERE (('true') AND (((((\"public\".\"article\".\"author_id\") = ($2)) AND ('true')) AND ('true')) AND ('true'))) RETURNING * ) SELECT json_build_object('affected_rows', (SELECT COUNT(*) FROM \"public_article__mutation_result_alias\" ) ) ",
"prepared": true,
"error": {
"exec_status": "FatalError",
"hint": null,
"message": "multiple assignments to same column \"id\"",
"status_code": "42601",
"description": null
},
"arguments": [
"(Oid 23,Just (\"\\NUL\\NUL\\NUL\\SOH\",Binary))",
"(Oid 23,Just (\"\\NUL\\NUL\\NUL\\SOH\",Binary))"
]
},
"path": "$",
"code": "unexpected"
},
"message": "postgres query error"
}
]
}Ideally, the server should make a validation check if a column is being updated using multiple operators.