Skip to content

test: Reproduce incorrect type inference for self-referential UUID FK (PostgreSQL) #817

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

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

Conversation

SergioAFRTM
Copy link

@SergioAFRTM SergioAFRTM commented Jul 14, 2025

This PR adds a failing test case to reproduce a bug where a self-referential belongs to relationship with a UUID foreign key is incorrectly migrated as bigint instead of uuid for PostgreSQL databases.

The test defines a User struct with the problematic relationship and runs AutoMigrate. The test will fail because the generated DDL has the wrong column type for the foreign key.

This test is for issue #7517 in the main go-gorm/gorm repository.

(Note that SQLite also fails, but I'm not knowlegable enough on SQLite syntax to understand exaclty why)

Added self referential UUID test to Users' model.
Update the dependencies to the latest versions available.
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.

1 participant