Team - I am getting a mutation failure.
v.1.1.0-beta.2 not sure if in previous builds
Problem: Mutation is failing due to null type cast.
Browser Response:
{"errors":[{"extensions":{"path":"$","code":"unexpected"},"message":"postgres query error"}]}
Postgres Error:
SQL Error [42883]: ERROR: operator does not exist: text = integer
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Root Cause:
with "public_test__mutation_result_alias" as (
select * from (
values (('false')::boolean,
null, <-- this needs to be cast as an integer (e.g. null::integer) for joining template_id = id below
...
select
json_build_object('affected_rows',
...
(select * from "public"."test_template" where ((("_0_root.base"."template_id") = ("id")) and
Additional Comments:
This is a outer join to a related table (integer to integer) with no foreign keys.
If the value of the id is not null, the response is ok.
Thanks!
John
I'm facing the exact same issue: when returning an empty relationship (return foreign when foreign_id is NULL) from a mutation gives me the same postgres error. I'm omitting the relationship from returning as a immediate workaround.
I'm facing the exact same issue: when returning an empty relationship (return
foreignwhenforeign_idisNULL) from a mutation gives me the same postgres error. I'm omitting the relationship fromreturningas a immediate workaround.
Thanks for the tip about the workaround. That worked for me as well.
Repro is mentioned in https://github.com/hasura/graphql-engine/issues/3749
Apologies for the late response. Fixed in 53b9cabd88d61f7ffbf8720b201410ea2d0bace2. We'll be making a release shortly!
Most helpful comment
I'm facing the exact same issue: when returning an empty relationship (return
foreignwhenforeign_idisNULL) from a mutation gives me the same postgres error. I'm omitting the relationship fromreturningas a immediate workaround.