hasura / hasura/graphql-engine
bug: `update_many` feature can prevent startup on table name conflict
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.10.0
### Environment
Cloud/OSS
### What is the current behaviour?
[v2.10.0](https://github.com/hasura/graphql-engine/releases/tag/v2.10.0) introduces the ability to update multiple records in a single operation with the update_TABLE_many mutation.
This can cause naming type conflicts if a `TABLE_updates` table already exists.
Alarmingly, this seems to prevent server start on cloud, rendering the project inaccessible until downgraded.
Error message:
```json
{ "code": "unexpected", "error": "Found conflicting definitions for 'TABLE_updates'. The definition at mutation_root.update_TABLE_many.updates differs from the the definitions [mutation_root.insert_TABLE_updates_one, mutation_root.insert_TABLE_updates.returning, query_root.TABLE_updates_by_pk, query_root.TABLE_updates].", "path": "$" }
```
### What is the expected behaviour?
This should be listed as a breaking change and should not prevent server start.
### How to reproduce the issue?
1. create and track the following tables in a 2.8.0 project
```sql
CREATE TABLE asset (id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY);
CREATE TABLE asset_updates (id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY);
```
3. update the project to 2.10
4. server refuses to start
### Any possible solutions?
This can be worked around by renaming the offending tables, or using the table customization to effectively rename the type associated with a table.
### Product Eng team checkpoints:
- [ ] https://github.com/hasura/graphql-engine/issues/8866
- [x] https://github.com/hasura/graphql-engine-mono/issues/5887
Contributor guide
Research direction
Reproduce the startup failure using the update_TABLE_many mutation and the asset_updates table described in the issue, then trace the generated schema definitions and startup validation. Done means a 2.8.0 project upgraded to 2.10 starts successfully despite the table-name conflict, with the breaking change documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, postgresql
- Domain
- api, backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100