Named parameters not working in subquery inside MySQL IN clause
Version
1.12.0
What happened?
On use subquery inside MySQL IN or NOT IN clauses, parameters not working. When I use sqlc.arg(), generated code not recognizes parameter. When I use ? character, the param code not is generated.
Relevant log output
No response
Database schema
CREATE TABLE authors (
id BIGINT PRIMARY KEY,
name text NOT NULL,
bio text
);
CREATE TABLE posts (
id BIGINT PRIMARY KEY,
title text NOT NULL,
author_id BIGINT
);
SQL queries
-- name: GetPost :one
SELECT * FROM posts WHERE author_id NOT IN (SELECT id FROM authors WHERE name LIKE sql.arg(author_name))
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "mysql",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/e9769ccb921829a2e7b8c073d5ee67ac9a8eeaa9744f0e4a94f94d46102716e4
What operating system are you using?
No response
What database engines are you using?
MySQL
What type of code are you generating?
Go
I've reproduced this in the latest version here. ? placeholders work fine; it's just the sqlc.arg() syntax.
i also can reproduce this issue with 1.18.
It seems to work correctly in 1.20. https://play.sqlc.dev/p/11240140f47c8020ec97bedca3d8200b4a22c9557ed9f4acf1e0d5afcc116626