Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 5345 PostgreSql SELECT DISTINCT ON #5353

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

griffio
Copy link
Contributor

@griffio griffio commented Jul 13, 2024

fixes #5345

Update DistinctOnExpressionMixin to expose tables (if prefix present) or use previous code that exposes columns

  • When exposing tables there could be DISTINCT ON columns with the same table prefix then remove duplicate tables

Update fixture test to include queries with multiple tables and columns

Add Integration test to validate compiled queries and prevent regressions

@griffio griffio marked this pull request as ready for review July 13, 2024 16:03
Update DistinctOnExpressionMixin.kt - expose missing tables

Query the columns or any tables prefixing columns in the distinctOn clause

As there could be one or more columns with the same table prefix, remove any duplicates
fixture tests - multiple tables and columns in DISTINCT ON
integration test - valid sql is generated and helps prevent regressions
@griffio griffio force-pushed the fix-5345-postgresql-distinct-on branch from 659a30d to e182037 Compare July 15, 2024 07:54
As the code is was using mapNotNull
Remove unnecessary null type parameter and not-null assertion operator
@JakeWharton JakeWharton merged commit 40590a5 into cashapp:master Jul 16, 2024
11 checks passed
@JakeWharton
Copy link
Member

Thanks!

@griffio griffio deleted the fix-5345-postgresql-distinct-on branch July 16, 2024 16:16
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.

postgresql: unable to specify table in SELECT DISTINCT ON (...)
2 participants