hasura / hasura/graphql-engine
Creating relationships from foreign key fails for DB with namespace
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Environment
Hasura Cloud
### What is the current behaviour?
When using two databases with conflicting schema, the use of a namespace can help avoid conflicts.
But when I try to create relationships from the foreign keys detected in a database under a namespace, the creation hits an error:
`Creating relationship failed`
```
Found conflicting definitions for 'MY_TABLE_bool_exp'. The definition at query_root.testnet2.domain.where differs from the the definitions [query_root.MY_NAMESPACE.MY_TABLE_aggregate.where...
```
### What is the expected behaviour?
Relationships get created without error
### How to reproduce the issue?
1. Connect to two postgresql dbs in with the same schema in the same hasura instance
2. Add unique namespaces for each in the Root Fields setting
3. Attempt to create relationships from foreign keys
### Screenshots or Screencast

### Keywords
Postgresql foreign key relationship root fields namespace
Contributor guide
Research direction
Reproduce the failure with two PostgreSQL databases sharing a schema, unique Root Fields namespaces, and relationships created from detected foreign keys. Then trace relationship creation and namespace handling to identify where conflicting GraphQL definitions are produced; done means those relationships are created without the reported conflict.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, postgresql
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100