Opened 6 years ago
Last modified 6 years ago
#29787 closed Bug
ForeignKey to User with BigIntegerField id/pk gets created as 'integer' instead of 'bigint' field in postgres — at Initial Version
Reported by: | Andrew Badr | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I ran into this bug when upgrading from 1.10 to 1.11. Doing a git bisect tracked it down to the 1.11.7->1.11.8 change, and specifically b8a2f3c2d66aa15af4be745a576609b958a853c0 is the first bad commit (fix for #28305).
My test case creates a User model instance, then creates another model instance pointing to it via ForeignKey. On 1.11.7, this works fine, and inspecting the database shows the fk field as having type 'bigint' in postgres. On 1.11.8, the test fails, and inspecting the db shows the field as a regular 'integer'.
I tried to repro with a minimal test case on a fresh project, but sadly was not able to recreate the bug. (It worked fine.) So there must be some other config in my project that's affecting this. If I have time I'll try to pin it down (already spent 2 hours on this), but maybe someone who worked on that patch can make an educated guess on what's happening?