Skip to content

fix: Resolve ORDER BY over unprojected columns in aliased projections - #220

Merged
MazterQyou merged 1 commit into
cubesql-3-04-2022from
cubesql/order-by-unprojected-columns
Jul 16, 2026
Merged

fix: Resolve ORDER BY over unprojected columns in aliased projections#220
MazterQyou merged 1 commit into
cubesql-3-04-2022from
cubesql/order-by-unprojected-columns

Conversation

@MazterQyou

Copy link
Copy Markdown
Member

This PR fixes a planning error where ORDER BY referencing a column absent from an aliased projection (e.g. a CTE ordering by a column it doesn't select) failed with column "..." must appear in the GROUP BY clause or be used in an aggregate function, because the sort column pushed into the projection got its qualifier replaced by the projection alias while the sort expression kept referencing the original relation. Related test is included.

Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
@MazterQyou
MazterQyou force-pushed the cubesql/order-by-unprojected-columns branch from ae47f8e to 369a635 Compare July 15, 2026 16:30
@MazterQyou MazterQyou changed the title fix: Resolve ORDER BY over unprojected columns in aliased projections fix: Resolve ORDER BY over unprojected columns in aliased projections Jul 15, 2026
@MazterQyou
MazterQyou merged commit ed911e3 into cubesql-3-04-2022 Jul 16, 2026
22 checks passed
@MazterQyou
MazterQyou deleted the cubesql/order-by-unprojected-columns branch July 16, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant