Closed
Description
Version
1.20.0
What happened?
When doing a LEFT JOIN that contains a parameter ? , it will not become exposed in golang, and thus is unusable.
Same bug occurs when doing a WHERE NOT EXIST () subquery, sub parameters will not become exposed.
See playground for demonstration:
https://play.sqlc.dev/p/1b212317a1c11271a95746dbfd15710e0c7a1d408cd0440093dd7ba2b05c0a03
Relevant log output
No response
Database schema
CREATE TABLE npcs (
id INT PRIMARY KEY
);
CREATE TABLE messages (
id INT PRIMARY KEY,
npc_id INT NOT NULL,
message text
);
SQL queries
-- name: GetNpcsThatDontHaveMessage :many
SELECT a.* FROM npcs a LEFT JOIN messages b ON a.id = b.npc_id and b.message=? WHERE b.id IS NULL;
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "sqlite",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/1b212317a1c11271a95746dbfd15710e0c7a1d408cd0440093dd7ba2b05c0a03
What operating system are you using?
Windows
What database engines are you using?
SQLite
What type of code are you generating?
Go