Graphql-engine: Mutation Result Get Postgres Query Error when returning null linked field

Created on 22 Jan 2020  路  4Comments  路  Source: hasura/graphql-engine

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

server bug

Most helpful comment

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.

All 4 comments

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 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.

Thanks for the tip about the workaround. That worked for me as well.

Apologies for the late response. Fixed in 53b9cabd88d61f7ffbf8720b201410ea2d0bace2. We'll be making a release shortly!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lishine picture lishine  路  3Comments

leoalves picture leoalves  路  3Comments

EmrysMyrddin picture EmrysMyrddin  路  3Comments

bogdansoare picture bogdansoare  路  3Comments

stereobooster picture stereobooster  路  3Comments