hasura / hasura/graphql-engine

Introspect command does not pick up table column renames

Open
#10,699 6 comments 0 reactions 0 assignees View on GitHub
k/v3-bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Component

This issue pertains to:
CLI -> c/v3-cli
Postgres (for issues that clearly relates to Postgres SQL execution) -> c/v3-ndc-postgres

### What is the current behaviour?

1. Rename a column in your table in pgsql
2. Run `ddn connector introspect sivvy_neon`
3. Run `model add`, `command add`, `relationship add` commands.

Observe that renamed column name is still listed as previous column name.

As a result running `supergraph build local` or `build create` will throw an error similar to this:

`ERR Code=opendds-validation Message="invalid metadata: error building schema: invalid metadata: unknown target column name status for field status in object type InsertProvidersObject (in subgraph app)"`

### What is the expected behaviour?

Expected behavior would be that columns that are renamed are picked up in the introspect command, and updated throughout following commands.

### How to reproduce the issue?

1. Spinup a hasura ddn -> pgsql connector
2. Generate a table, generate some columns
3. Run through introspect command
4. Rename a column in the table
5. Run introspect command again
6. Notice issue

### Screenshots or Screencast

N/A

### Please provide any traces or logs that could help here.

Error log provided above.

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

Manually updating the renamed column in the `.hml` files in metadata seems to bypass this issue.

### Keywords

'rename', 'pgsql rename column'

Contributor guide

Open the contributing guide

Research direction

Reproduce the problem with a Postgres connector using `ddn connector introspect`, then inspect the c/v3-cli introspection entry point and the follow-up `model add`, `command add`, and `relationship add` commands. Done means a renamed column is reflected after the second introspection and `supergraph build local` or `build create` no longer reports the old target column name.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
cli, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.