graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

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

Open harishnair96 opened this issue 2 years ago • 0 comments

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
  }
}  
  1. 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

harishnair96 avatar Sep 19 '22 11:09 harishnair96