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

PG v10 GENERATED BY DEFAULT AS IDENTITY result in Not-NULL violation #2508

@dekc

Description

@dekc

To reproduce:
0. Important: make sure to run this mutation as anonymous (ie not as hasura admin etc). Set "anonymous" permisions on insert and select actions for example (as shown in the link below)

https://media.discordapp.net/attachments/428469959530643466/598763216192929792/unknown.png?width=1321&height=720

  1. Create following table:
CREATE TABLE color (
    color_id INT GENERATED BY DEFAULT AS IDENTITY,
    color_name VARCHAR NOT NULL
);
  1. Run following mutation:
 mutation colorInsert{
  insert_color(objects: {color_name: "green"}){
    returning {
      color_id
      color_name
    }
  }
}

You should the see the following result:

{
  "errors": [
    {
      "extensions": {
        "path": "$.selectionSet.insert_color.args.objects",
        "code": "constraint-violation"
      },
      "message": "Not-NULL violation. null value in column "color_id" violates not-null constraint"
    }
  ]
}

Further info:

  • Hasura running ontop of a v10 PG database
  • Hasura v1.0.0-beta.2
  • Note: that it works if x-hasura-admin-secret header is passed in console headers

Metadata

Metadata

Assignees

Labels

c/serverRelated to servere/easycan be wrapped up in a couple of daysk/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions