Skip to content

Embed One-to-One relationships with different column order properly #3659

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

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

wolfgangwalther
Copy link
Member

@wolfgangwalther wolfgangwalther commented Jul 13, 2024

Currently, One-to-One relationships are only detected properly, when the column order in the FK definition is sorted by ascending attnum of the target table's PK / Unique constraint.

This can easily be seen by the change I made to fixtures.sql. This immediately breaks some spec tests, because the relationship is not detected as O2O anymore. After the fix however, I can sort the columns how I like and the O2O is still detected.

I then proceeded to make the related query a bit simpler.

@wolfgangwalther wolfgangwalther merged commit d7da181 into PostgREST:main Jul 13, 2024
21 of 22 checks passed
@wolfgangwalther wolfgangwalther deleted the fix-o2o branch July 13, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants