Closed
Description
Version
1.10.0
What happened?
When I join another table using LEFT OUTER JOIN
, the referenced colums are not treated as potential NULL
.
For example, int32
is used instead of sql.NullInt32
Relevant log output
No response
Database schema
CREATE TABLE authors
(
id INT(10) NOT NULL,
name VARCHAR(255) NOT NULL,
parent_id INT(10),
PRIMARY KEY (id)
);
CREATE TABLE parents
(
id INT(10) NOT NULL,
name VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
SQL queries
-- name: AllAuthors :many
SELECT authors.id,
authors.name,
parents.id as alias_id,
parents.name as alias_name
FROM authors LEFT OUTER JOIN parents ON (authors.parent_id = parents.id);
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "mysql",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/ce7fec524f816ea7f485c8d9b83c60a0e36c7de065db7d23150d7271ce59bd90
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go