hasura / hasura/graphql-engine
Nested Insert is not referencing id from parent
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version:
CLI Version (for CLI related issue): 2.3.0
### Environment
Cloud - Heroku
### What is the expected behaviour?
The most nested object should still reference the id created from the parent.
### Keywords
- Nested Insert
- Insert an object along with its related objects through relationships
### What is the current behaviour?
Comment ID on the menu_item_restriction table is null.
### How to reproduce the issue?
1. Create tables similar to the screenshot
2. Insert a row that deep
3. column will be null
**Mutation Code**
```
export const CreateReview = gql`
mutation createReview (
$user_id: String!,
$place_id: Int!,
$rating: Int!,
$text: String!,
$comment_menu_items: comment_menu_item_arr_rel_insert_input,
$existing_menu_items: [menu_item_restriction_insert_input!]!
$sid: String
) {
insert_comment(
objects: {
rating: $rating,
user_id: $user_id,
text: $text,
comment_places: {data: {place_id: $place_id}},
comment_menu_items: $comment_menu_items,
sid: $sid,
}) {
returning {
id
}
},
insert_menu_item_restriction(objects: $existing_menu_items, on_conflict: {constraint: menu_item_restriction_pkey, update_columns: []}) {
returning {
menu_item_id
restriction_id
}
}
}
`;
```
### Screenshots or Screencast




### Please provide any traces or logs that could help here.
### Any possible solutions?
### Can you identify the location in the source code where the problem exists?
### If the bug is confirmed, would you be willing to submit a PR?
Contributor guide
Assessment
This issue has not been assessed yet.