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] Fix fk introspection ordering columns wrongly (critical failure) #3994

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Mardoxx
Copy link

@Mardoxx Mardoxx commented Jan 24, 2025

Fixes #3993

No idea how to contrib to this, someone can tidy this up if it's wrong.

tl;dr the old implementation was not sympathetic to the order of the columns in the fk relationshops, so when introspecting it would, in some cases, cause the generated SQL to be completely wrong - mismatched columns.

@Mardoxx
Copy link
Author

Mardoxx commented Jan 24, 2025

idk how to add tests proper, only tested this in situ, no idea if the test will run. ci driven development lol.

Comment on lines +920 to +921
columns: [table.ownerId, table.profileImageId],
foreignColumns: [userProfileImages.ownerId, userProfileImages.id],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of these matters. Previously it had weird behaviour where it would appear that these were sorted. The information is in the linked issue. Perhaps there is a better way to describe the preconditions

@Mardoxx Mardoxx changed the title Fix fk introspection Fix fk introspection ordering columns wrongly (critical failure) Jan 25, 2025
@Mardoxx Mardoxx changed the title Fix fk introspection ordering columns wrongly (critical failure) [PG] Fix fk introspection ordering columns wrongly (critical failure) Jan 25, 2025
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.

[BUG]: Multi column foreign key columns are sorted individually on introspection (critical bug)
1 participant