Skip to content

Fix Last() on primitive collections returning the first array element - #3925

Merged
roji merged 1 commit into
npgsql:mainfrom
sanjaysingh:fix/3909-primitive-collection-last
Oct 14, 2026
Merged

roji merged 1 commit into
npgsql:mainfrom
sanjaysingh:fix/3909-primitive-collection-last

Conversation

@sanjaysingh

@sanjaysingh sanjaysingh commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • dotnet build for EFCore.PG and EFCore.PG.FunctionalTests

…s the last element.

The unnest cleanup treated that sort as redundant and collapsed Last() to LIMIT 1.

Co-authored-by: Cursor <cursoragent@cursor.com>

@roji roji left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, LGTM!

@roji
roji enabled auto-merge (squash) October 14, 2026 19:16
@roji
roji merged commit 8d1e92e into npgsql:main Oct 14, 2026
10 checks passed
roji added a commit that referenced this pull request Oct 14, 2026
Backport #3925 to hotfix/10.0.4, preserving descending ordinality for Last/LastOrDefault and retaining later tables during unnest cleanup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 655047e3-ebb2-4a2e-9817-c998f679450e
roji added a commit that referenced this pull request Oct 14, 2026
…lement (#3957)

Backport #3925, including retained-table copying, and adapt Last/LastOrDefault regressions to the 9.0 async test API.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a1fb0d48-c667-44a2-849d-7cf03dec429c
roji added a commit that referenced this pull request Oct 14, 2026
…3958)

Backport #3925 at 32c2baa, including retained-table copying and the Last/LastOrDefault regression tests adapted to EF 8 APIs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ea931961-9d81-454e-8f33-6a80c71febad
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.

Last()/LastOrDefault() on primitive collections is translated like First() — missing descending ordinality ordering

2 participants