Version
1.27.0
What happened?
When using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a "column does not exist" error. This occurs even though the column is correctly defined and aliased in the subquery.
Relevant log output
query.sql:18:3: 396: column "full_name" does not exist
Database schema
CREATE TABLE customers (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
first_name varchar(255) not null,
last_name varchar(255) not null
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4;
SQL queries
-- name: GetFullNames :many
SELECT
full_name
FROM
(
SELECT
concat(first_name, ' ', last_name) as full_name
FROM
customers
) subquery
WHERE
full_name IN (sqlc.slice ("full_names"));
Configuration
{
"version": "2",
"sql": [
{
"schema": "query.sql",
"queries": "query.sql",
"engine": "mysql",
"gen": {
"go": {
"package": "db",
"out": "db"
}
}
}
]
}
Playground URL
https://play.sqlc.dev/p/043ded77492cec27dbba4e964774d08836ad76227a585856ae284f13f9046f24
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Version
1.27.0
What happened?
When using sqlc.slice() with a column computed in a subquery, sqlc generate fails with a "column does not exist" error. This occurs even though the column is correctly defined and aliased in the subquery.
Relevant log output
query.sql:18:3: 396: column "full_name" does not existDatabase schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/043ded77492cec27dbba4e964774d08836ad76227a585856ae284f13f9046f24
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go