hasura / hasura/graphql-engine

Index naming conflict when same table named used in multiple schemas

Open
#7,761 1 comment 3 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

v2.0.10-cloud.1
Hasura Hosted Database

Hasura has issues tracking indexes when multiple tables exist with the same name in different schemas.

In the image below you will see the table named employee has been created in three separate schemas: prx, public and test

Each table has an id integer autoincrement as a primary key.

When selecting the modify tab for any of the employee tables the indexes of the other employee tables appear in its modification section. I am not sure how the system handles the naming conflict.

### Screenshots or Screencast
![HasuraBug](https://user-images.githubusercontent.com/17455596/139754129-aad75b65-d6cc-4bfd-b81b-ab042f759c3a.jpg)

### Any possible solutions?

It maybe best to append the schema name to all indexes and contraints.
i.e. schema_table_idx
This would follow the structure used in the GraphQL generated query statements.

### If the bug is confirmed, would you be willing to submit a PR?
Sure.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; start at the table modify tab and reproduce the behavior with employee tables in the prx, public, and test schemas. Trace how indexes are selected for each table, then verify that each modify view shows only its own indexes and add regression coverage for same-named tables across schemas.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.