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

Boolean filter generation fails for SQLite #2424

Closed
SoMuchForSubtlety opened this issue Jul 10, 2023 · 1 comment · Fixed by #2470
Closed

Boolean filter generation fails for SQLite #2424

SoMuchForSubtlety opened this issue Jul 10, 2023 · 1 comment · Fixed by #2470
Milestone

Comments

@SoMuchForSubtlety
Copy link
Contributor

SoMuchForSubtlety commented Jul 10, 2023

Version

1.18.0

What happened?

Boolean filter expressions don't seem to get processed correctly. I can get it to work by changing the query slightly, but then I lose type information.

Relevant log output

No response

Database schema

create table my_table
(
    invalid boolean,
    foo     varchar
);

SQL queries

-- name: GetData :many
select *
from my_table
where (cast(sqlc.arg(allow_invalid) as boolean) or not invalid);

Configuration

No response

Playground URL

https://play.sqlc.dev/p/80e82864f4994ee1812495bbdfa2bd351fdfa43f1a15968dc61d192e79b22e28

What operating system are you using?

Linux

What database engines are you using?

SQLite

What type of code are you generating?

Go

@SoMuchForSubtlety SoMuchForSubtlety added bug Something isn't working triage New issues that hasn't been reviewed labels Jul 10, 2023
@kyleconroy kyleconroy added 🔧 golang 📚 sqlite 💻 linux and removed triage New issues that hasn't been reviewed labels Jul 10, 2023
@kyleconroy kyleconroy modified the milestones: v1.19.1, v1.20.0 Jul 10, 2023
@andrewmbenton
Copy link
Collaborator

Looks like we are at the very least not correctly handling the cast node correctly

orisano added a commit to orisano/sqlc that referenced this issue Jul 16, 2023
kyleconroy pushed a commit that referenced this issue Jul 24, 2023
* fix(engine/sqlite): added function to convert cast node

fix #2424

* test: add endtoend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants