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

feat(postgres): Ensure ordering of index columns is always stable #623

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

95ulisse
Copy link
Contributor

Hello 👋

First of all, thanks for the great work on this project!

I use tbls with Postgres in the CI pipeline of some services I work on in my daily job and I noticed that the order of the columns in multi-column indexes is not always stable. In particular, it can change across different Postgres versions because the query used to analyze the schema does not specify an order for the column names.

This PR adds an ORDER BY attr.attnum ASC clause to such query so that the column names are always returned in the same order for multi-column indexes. This order should match the actual definition of the index (even if I'm not 100% sure, as the official docs are not super clear about it 😅).

Thanks!

@k1LoW
Copy link
Owner

k1LoW commented Oct 18, 2024

@95ulisse Thank you!!

@k1LoW k1LoW merged commit fe140f5 into k1LoW:main Oct 18, 2024
3 checks passed
@github-actions github-actions bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants