apache / apache/gravitino

[Feature Request] In PosgresSQL indexes on foriegn key don't show up as indexes.

Open
#2,440 6 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 15h
Merged PRs (30d)
315

Description

### Version

main branch

### Describe what's wrong

If you create a foreign key and index it doesn't show up as an index in the REST result.

### Error message and/or stacktrace

N/A

### How to reproduce

Using the playground, create an index on a foreign key like so:
```SQL
alter table hr.employees add constraint FK_departments foreign key(department_id) references hr.departments(department_id);
create index on hr.employees(department_id);
```

Run this:
```
curl http://localhost:8090/api/metalakes/metalake_demo/catalogs/catalog_postgres/schemas/hr/tables/employees
```

And indexes will be an empty array.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the REST endpoint shown in the reproduction and trace how the PostgreSQL table metadata is gathered for hr.employees. Reproduce the foreign-key and index SQL in the playground, then verify that the REST result includes the index rather than an empty array. Confirm the behavior with an appropriate regression test if the existing test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
api, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.