-
Notifications
You must be signed in to change notification settings - Fork 902
Closed
Labels
bugSomething isn't workingSomething isn't workingtriageNew issues that hasn't been reviewedNew issues that hasn't been reviewed
Description
Version
1.20.0
What happened?
When attempting to use NOT IN
with an sqlc.slice
of arguments, the generated SQL query in the Go code results in:
const getAuthorNotIn = `-- name: GetAuthorNotIn :many
SELECT id, name, bio FROM authors
where true != false
and id not in (sqlc.slice('userIDs'))
`
Which as we can see has not correctly interpolated the sqlc.slice
.
This works when using IN
, but not when there's a NOT IN
.
Relevant log output
No response
Database schema
CREATE TABLE authors (
id BIGSERIAL PRIMARY KEY,
name text NOT NULL,
bio text
);
SQL queries
-- name: GetAuthorIn :many
SELECT id, name, bio FROM authors
where id in (sqlc.slice('userIDs'));
-- name: GetAuthorNotIn :many
SELECT id, name, bio FROM authors
where id not in (sqlc.slice('userIDs'));
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "sqlite",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/5da40f5dacdf8eebf5f92c67e572bac04c578a58e4629dd64c752bb99a9189ae
What operating system are you using?
Linux
What database engines are you using?
SQLite
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriageNew issues that hasn't been reviewedNew issues that hasn't been reviewed