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

Do not isolate distinct to avoid missing renames #168

Merged
merged 2 commits into from
Mar 11, 2021
Merged

Do not isolate distinct to avoid missing renames #168

merged 2 commits into from
Mar 11, 2021

Conversation

TomMD
Copy link
Contributor

@TomMD TomMD commented Feb 13, 2021

Fix #165 by removing isolate from distinct calls.

Recall that queries in the form:

borked :: Query s (Col s Int)
borked = aggregate $ do
    _ <- distinct $ do
            t <- select people
            pure (t ! #msg)
    x <- distinct $ do
            t <- select people
            pure (t ! #name)
    pure (count x)

Cause Selda + the psql backend to fail. For a complete program see #165 and a throw-away psql such as docker run -p 5432:5432 --rm -e POSTGRES_PASSWORD=password -d postgres.

This query now succeeds along with make test and the make pgtest target. That said, I don't claim to have shoved the whole selda design into my head so viewing the PR with some suspicion is warranted.

@TomMD
Copy link
Contributor Author

TomMD commented Feb 14, 2021

I've now added a regression test.

@valderman
Copy link
Owner

Very nice; thanks a lot for taking the time to diagnose and fix this!

@valderman valderman merged commit 3aafbd0 into valderman:master Mar 11, 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.

Invalid queries generated for PSQL when using two distinct clauses
2 participants