Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg_index does not include primary keys #17252

Closed
neverchanje opened this issue Jun 14, 2024 · 3 comments · Fixed by #17262
Closed

pg_index does not include primary keys #17252

neverchanje opened this issue Jun 14, 2024 · 3 comments · Fixed by #17262
Assignees
Milestone

Comments

@neverchanje
Copy link
Contributor

neverchanje commented Jun 14, 2024

Is your feature request related to a problem? Please describe.

Primary keys are automatically indexes in Postgres, specially tagged via the indisprimary column in pg_index;

In RisingWave, our pg_index only shows indexes created via CREATE INDEX.

Since we do not have other ways around to show all indexes and PKs within a database schema in a single query, we have to iterate over all tables and query through show columns from <rel>. This is very inconvenient and error-prone.

Describe the solution you'd like

We should at least include primary keys in pg_index and consider adding them to rw_indexes;

Describe alternatives you've considered

No response

Additional context

No response

@yezizp2012
Copy link
Member

For PKs, what content should we fill in column indexdef? Should we leave it empty or construct a fake one like CREATE UNIQUE INDEX XXXX_index ON public.XXXX USING btree (col1, col2)?

@neverchanje
Copy link
Contributor Author

neverchanje commented Jun 14, 2024

@yezizp2012

indexdef is in the table pg_indexes
What I proposed to add is the information for pg_index.

I did't see tools accessing pg_indexes so far, so it'll be fine to leave it empty as it is now.

@yezizp2012
Copy link
Member

They all relies on rw_indexes, which contains a definition column. Well, let's leave it empty for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants