hasura / hasura/graphql-engine

Renaming column from console partially succeeds even when it would result in inconsistency

Open
#8,982 0 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: Many versions (Tested on 2.8.4, 2.12.0-beta.1)

### Environment

OSS

### What is the current behaviour?

Hasura does not completely prevent a column from being renamed when it would result in inconsistent metadata. Hasura shows the message `cannot continue due to newly found inconsistent metadata` which indicates that the action didn't succeed but it still renames the table. In other words the renaming partially succeeds.

Once this happens, the queries do not work either with the new column name or the old column name (shown in screenshots). Hasura doesn't report any metadata inconsistencies either so everything seems normal even when it's not.

### What is the expected behaviour?

The renaming must either completely succeed or completely fail.

### How to reproduce the issue?

1. Create and track the following table `CREATE TABLE sometable(id SERIAL PRIMARY KEY, val TEXT);`
2. Track the following query as REST API (/api/rest/someresource)
```
query SomeQuery {
sometable {
id
val
}
}
```
3. Rename column `val` to `val2`.

### Screenshots or Screencast

Screenshot 2022-09-19 at 3 43 21 PM
Screenshot 2022-09-19 at 3 43 38 PM
Screenshot 2022-09-19 at 3 46 27 PM
Screenshot 2022-09-19 at 3 46 36 PM

### Any possible solutions?

Reloading the metadata with 'Reload all databases' enabled fixes the problem. This also shows the inconsistency which needs to be fixed.

### Keywords

renaming

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.