Skip to content

Fix for group by in sub-query - #881

Merged
Thorium merged 4 commits into
fsprojects:masterfrom
Thorium:master
Nov 3, 2026
Merged

Thorium merged 4 commits into
fsprojects:masterfrom
Thorium:master

Conversation

@Thorium

@Thorium Thorium commented Nov 2, 2026

Copy link
Copy Markdown
Member

Fix for group by in sub-query 746

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Grouped membership subqueries can silently drop scalar computations and inconsistently suppress grouping keys across set-operation operands, producing incorrect comparisons or column-count errors.

2 open issues
What changed in this PR

This PR addresses grouped aggregate subqueries in SQLProvider by omitting grouping keys from IN/NOT IN select lists while preserving them for standalone grouped queries.

Changes:

  • Introduces explicit grouping metadata and shared select-list formatting across database providers.
  • Adds regression tests for grouped membership subqueries and standalone key preservation.
  • Updates release notes, cleans up documentation directives, and upgrades two test dependencies.
File Description
tests/​SqlProvider.Tests/​more/​SubqueryCompositionTests.fs Tests grouped IN/NOT IN and standalone key preservation.
tests/​SqlProvider.Core.Tests/​MySql/​SqlProvider.Core.Tests.fsproj Upgrades MySqlConnector to 2.3.1.
tests/​SqlProvider.Core.Tests/​MsSqlSsdt/​MsSqlSsdt.Tests/​MsSqlSsdt.Tests.fsproj Updates FSharp.Core to 10.0.109.
src/​SQLProvider.Runtime/​Providers.SQLite.fs Applies shared grouped select-list handling for SQLite.
src/​SQLProvider.Runtime/​Providers.Postgresql.fs Applies shared grouped select-list handling for PostgreSQL.
src/​SQLProvider.Runtime/​Providers.Oracle.fs Applies shared grouped select-list handling for Oracle.
src/​SQLProvider.Runtime/​Providers.Odbc.fs Applies shared grouped select-list handling for ODBC.
src/​SQLProvider.Runtime/​Providers.MySql.fs Applies shared grouped select-list handling for MySQL.
src/​SQLProvider.Runtime/​Providers.MsSqlServer.Ssdt.fs Applies shared grouped select-list handling for SSDT.
src/​SQLProvider.Runtime/​Providers.MsSqlServer.fs Applies shared grouped select-list handling for SQL Server.
src/​SQLProvider.Runtime/​Providers.MsSqlServer.Dynamic.fs Applies shared grouped select-list handling for dynamic SQL Server.
src/​SQLProvider.Runtime/​Providers.MSAccess.fs Applies shared grouped select-list handling for Access.
src/​SQLProvider.Runtime/​Providers.Firebird.fs Applies shared grouped select-list handling for Firebird.
src/​SQLProvider.Runtime/​Providers.DuckDb.fs Applies shared grouped select-list handling for DuckDB.
src/​SQLProvider.Common/​SqlRuntime.QueryExpression.fs Adds conversion mode controlling grouping-key selection.
src/​SQLProvider.Common/​SqlRuntime.Linq.fs Uses key-suppression mode for membership subqueries.
src/​SQLProvider.Common/​SqlRuntime.Common.fs Adds grouping metadata and shared select-list formatter.
docs/​RELEASE_NOTES.md Documents the grouped-subquery fix.
docs/​content/​index.fsx Removes the leading hide directive.
docs/​content/​core/​mssql.fsx Removes duplicate hide and include directives.
docs/​content/​core/​general.fsx Removes a redundant hide directive.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Value-changing numeric conversions and name-only member matching can bypass projection validation, causing membership SQL to compare underlying values rather than the projected values.

2 open issues
2 resolved since last review

Review effort: Balanced

@Thorium
Thorium requested a balanced review from Copilot November 3, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Thorium
Thorium merged commit 6828dff into fsprojects:master Nov 3, 2026
3 checks passed
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.

2 participants