Skip to content

fix(orm): preserve nested partial select on left join when first column is null (#1603) - #6228

Open
ElvinGts wants to merge 1 commit into
drizzle-team:mainfrom
ElvinGts:fix/issue-1603-nested-left-join-null
Open

fix(orm): preserve nested partial select on left join when first column is null (#1603)#6228
ElvinGts wants to merge 1 commit into
drizzle-team:mainfrom
ElvinGts:fix/issue-1603-nested-left-join-null

Conversation

@ElvinGts

@ElvinGts ElvinGts commented Sep 3, 2026

Copy link
Copy Markdown

Fixes #1603
/claim #1603

Summary

Fixes an issue where mapResultRow improperly nullifies a nested partial-select object when the first selected field of a left-joined table evaluates to null, even if subsequent fields from the same table contain non-null values.

Root Cause

In mapResultRow (drizzle-orm/src/utils.ts), nullifyMap[objectName] stored the table name when encountering the first null column, but only cleared the nullify flag when encountering a field from a different table. Non-null values from the same table failed to reset the flag.

Changes

  • Corrected the nullification guard in mapResultRow to ensure any non-null column value immediately clears the pending nullification.
  • Preserves object structure when later fields in the same joined table have valid data.

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]: Nested Partial Select returns null on left join if first column value is null

1 participant