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: generate FALSE instead of expr in () conditions #4598

Merged
merged 5 commits into from
Jun 11, 2024

Conversation

Globidev
Copy link
Contributor

This is an attempt at fixing #4595

Disclaimer: Pretty fluent in Rust but I just discovered the codebase, so I probably missed a bunch of things.
I guess we'll want to add tests, and I'll likely need some directions as to where exactly to put them :)

@Globidev Globidev changed the title Generate FALSE instead of expr in () conditions fix: generate FALSE instead of expr in () conditions Jun 11, 2024
@max-sixty
Copy link
Member

Awesome @Globidev ! Nice work.

We can add a test next to

#[test]
fn test_not_in_values() {
assert_snapshot!((compile(r#"
from employees
filter !(title | in ["Sales Manager", "Sales Support Agent"])
"#).unwrap()), @r#"
SELECT
*
FROM
employees
WHERE
NOT title IN ('Sales Manager', 'Sales Support Agent')
"#);
}

Then running cargo insta test --accept (or task test-rust) will fill in the generated SQL.

@max-sixty
Copy link
Member

A changelog entry would be nice but not strictly required

@Globidev
Copy link
Contributor Author

Thanks a bunch for the pointers!

Feel free to point out anything that would be missing or need tweaking

@max-sixty
Copy link
Member

Super, thanks @Globidev !

@max-sixty max-sixty merged commit d6d6986 into PRQL:main Jun 11, 2024
36 checks passed
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