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 distinctOnOrderBy with nested expression #278

Merged
merged 2 commits into from
Sep 2, 2021

Conversation

NikitaRazmakhnin
Copy link
Contributor

@NikitaRazmakhnin NikitaRazmakhnin commented Aug 4, 2021

Should solve #277.
Code assembling DISTINCT ON clause was stripping important part of important nested expressions. It worked well without nested expressions but with them it just cuts by spaces parts with arguments. So for example with COALESCE(val, ?) ASC it splits assembled expression into ["COALESCE(val,", "?)", "ASC"] which causes bad sql for some cases.

I am not sure it is a good solution because I actually don't know is it possible to have other expressions here or not? Please, let me know if you see any other possible issues with that fix. :)

A related test-case is added.

Before submitting your PR, check that you've:

  • Bumped the version number.
  • Ran stylish-haskell and otherwise adhered to the style guide.

After submitting your PR:

  • Update the Changelog.md file with a link to your PR.
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts).

Copy link
Collaborator

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

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

fantastic, thanks!

@parsonsmatt parsonsmatt merged commit 18951b2 into bitemyapp:master Sep 2, 2021
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