hasura / hasura/graphql-engine

Deleting table succeeds even when it would result in inconsistent metadata

Open
#9,368 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 (Tried in v2.6.2, v2.8.4, v2.15.2, v2.16.1)

### Environment

Any (Tried in OSS)

### What is the current behaviour?

If you delete a table that would result in inconsistent metadata the console shows the error 'cannot continue due to newly found inconsistent metadata'. The error message implies that the action didn't succeed however the table is still deleted from the database but it doesn't get removed from the metadata. This is confusing especially because it doesn't show metadata inconsistency until metadata is reloaded.

The same issue exists if you delete a column/ just rename a column as mentioned in #8982

### What is the expected behaviour?

The deletion action should either succeed or fail. It shouldn't partially succeed. If a message such as 'cannot continue due to newly found inconsistent metadata' is shown, then the action should completely fail and no deletion must happen as that is what the message implies.

### How to reproduce the issue?

1. Create and track the table
```sql
CREATE TABLE author(id SERIAL PRIMARY KEY, name TEXT);
```
2. Add the following query to query collection
```graphql
query Authors {
author {
id
name
}
}
```
3. Delete the table

### Any possible solutions/workarounds you're aware of?

Reload the metadata to show the inconsistencies and then remove the inconsistent table.

### Keywords

table deletion

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Reproduce the issue with the provided PostgreSQL table and GraphQL query, then trace table deletion and metadata reload behavior; done means the action either fully succeeds or leaves the table unchanged when inconsistent metadata is detected.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgres, sql
Domain
api, backend-api-design, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.