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

values_ produces invalid SQL when passed empty list #559

Open
thomasjm opened this issue Apr 5, 2021 · 1 comment · May be fixed by #742
Open

values_ produces invalid SQL when passed empty list #559

thomasjm opened this issue Apr 5, 2021 · 1 comment · May be fixed by #742
Labels
breaking change Change will require a major version bump bug
Milestone

Comments

@thomasjm
Copy link
Contributor

thomasjm commented Apr 5, 2021

I noticed that a query like values_ [] (against Postgres) produces invalid SQL like this:

SELECT "t0"."res0" as "res0", ... FROM (VALUES ) AS "t0"("res0",...)

The empty VALUES statement causes an error syntax error at or near ")". Maybe it should accept a Data.List.NonEmpty list instead?

@kmicklas kmicklas added breaking change Change will require a major version bump bug labels May 30, 2021
@kmicklas
Copy link
Member

I'm wondering if there are any workarounds emitting different SQL. The closest I could come up with was:

select * from (select * from (values (null, null)) as dummy(x, y) limit 0) as t(x, y);

but maybe there is something even better.

@kmicklas kmicklas added this to the 0.10.0.0 milestone Aug 7, 2021
@LaurentRDC LaurentRDC linked a pull request Jan 12, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Change will require a major version bump bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants