Closed
Description
Version
1.21.0
What happened?
When writing a query like
INSERT INTO authors (
address,
name,
bio
) VALUES (
?,
COALESCE(sqlc.narg("authName"), ""),
COALESCE(sqlc.narg("authBio"), "")
);
Only the ? is recognised and add as a parameter to the insert query
Relevant log output
none - generate works
Database schema
CREATE TABLE authors (
id BIGINT AUTO_INCREMENT NOT NULL,
address VARCHAR(200) NOT NULL,
name VARCHAR(20) NOT NULL,
bio LONGTEXT NOT NULL
);
SQL queries
-- name: AddAuthor :execlastid
INSERT INTO authors (
address,
name,
bio
) VALUES (
?,
COALESCE(sqlc.narg("calName"), ""),
COALESCE(sqlc.narg("calDescription"), "")
);
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "mysql",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/8471d8c7965409b41c01510cf680b8026ae5268dc83ae2591e891c432aef0432
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go