Skip to content

feat: Add end-to-end test and compiler support for SQLite boolean arguments with the NOT operator.#4327

Open
noxymon wants to merge 1 commit intosqlc-dev:mainfrom
noxymon:fix/sqlite_boolean_argument
Open

feat: Add end-to-end test and compiler support for SQLite boolean arguments with the NOT operator.#4327
noxymon wants to merge 1 commit intosqlc-dev:mainfrom
noxymon:fix/sqlite_boolean_argument

Conversation

@noxymon
Copy link

@noxymon noxymon commented Mar 6, 2026

Summary of Changes

The goal was to resolve Issue #4305 where the NOT keyword breaks boolean argument detection for SQLite.

Cause of the Bug

When an expression like not @argname is parsed by cznic/sqlite, it produces an AST node which SQLC converts into an *ast.BoolExpr. During type inference, the compiler loops over the AST nodes wrapping parameters (inside internal/compiler/resolve.go ) to infer their basic types (e.g. limitOffset -> integer).
However,
internal/compiler/resolve.go
was completely missing a case *ast.BoolExpr:! Because of this, it fell back to generating an UnknownParam, which resulted in the type interface{} (or any) instead of bool/boolean.

The Fix

  1. Modified
    internal/compiler/resolve.go to intercept *ast.BoolExpr parameter bindings.
  2. Assigned them the explicit datatype boolean, ensuring SQLC correctly infers arguments wrapped in NOT, AND or OR as boolean inputs in Go output.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SQLite] not keyword breaks boolean argument detection

1 participant