ITADN

Drizzle ORM Bug Report: update().set() Does Not Update Nullable Foreign Key Column

#5741OpenTheMoeaegon 创建于 2026-05-11
bug
T
TheMoeaegoncommented
### Report hasn't been filed before. - [x] I have verified that the bug I'm about to report hasn't been filed before. ### What version of `drizzle-orm` are you using? 0.45.2 ### What version of `drizzle-kit` are you using? 0.31.10 ### Other packages _No response_ ### Describe the Bug When using Drizzle ORM with PostgreSQL, a nullable foreign key column (manufacturerId) is ignored during an update().set() operation, even though the value is present in the input object and is explicitly assigned in .set(). All other columns are updated correctly, but the foreign key column retains its previous value. Database Verification The PostgreSQL schema contains the column and foreign key constraint: manufacturer_id uuid REFERENCES manufacturers(id) ON DELETE RESTRICT The target manufacturer ID exists and is valid. Expected Behavior manufacturerId should be updated to the new UUID and returned in the result. Actual Behavior manufacturerId remains unchanged, even when explicitly set in .set(). schema of product table... <img width="1162" height="436" alt="Image" src="https://github.com/user-attachments/assets/ce4d0fb9-682f-4307-9aa7-6ced2f62348f" /> update query... <img width="1126" height="539" alt="Image" src="https://github.com/user-attachments/assets/203e4a46-05dc-406f-b8de-f6642128f3a5" /> update value input and its result <img width="1153" height="586" alt="Image" src="https://github.com/user-attachments/assets/03b26657-1302-4b1d-84fc-1080c4df54c6" />
1 条评论