这是indexloc提供的服务,不要输入任何密码
Skip to content

Hasura 2.0: cannot insert NULL on nullable column (specifically for nested inserts) #7484

@tokestermw

Description

@tokestermw

Hi, say we have a table A

id: number, primary key, unique, default: nextval
related_id: integer, nullable

and table B

id: number, primary key, unique, default: nextval
related_text: string

w/ foreign keys

related_id -> B.id

and add a relationship called relationship

Now since related_id is nullable, we should be able to insert

mutation MyMutation {
  insert_A(objects: {relationship: null}) {
    returning {
      relationship {
        id
        related_text
      }
    }
  }
}

I am getting the following error

"expected an object for type \"B_obj_rel_insert_input\", but found null"

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions