-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
93567: opt: add support for NULLS LAST with DISTINCT ON r=rytaft a=rytaft This commit adds an exception for the requirement that the `ORDER BY` clause of a `DISTINCT ON` query must contain only columns in the `ON` clause. Specifically, it allows expressions of the form `col IS NULL`, where `col` is one of the `ON` columns. This is needed to support `NULLS LAST`, since we implement `NULLS LAST` by synthesizing a `col IS NULL` ordering column. The approach feels a bit hacky, but it seems like the smallest, lowest risk option available. Fixes #90763 Release note (bug fix): Fixed an issue where `DISTINCT ON` queries would fail with the error "SELECT DISTINCT ON expressions must match initial ORDER BY expressions" when the query included an `ORDER BY` clause containing `ASC NULLS LAST` or `DESC NULLS FIRST`. Co-authored-by: Rebecca Taft <[email protected]>
- Loading branch information
Showing
3 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters