You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MySQL: LEFT OUTER JOINed columns not considered NULLable #1247
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
CREATETABLEauthors
(
id INT(10) NOT NULL,
name VARCHAR(255) NOT NULL,
parent_id INT(10),
PRIMARY KEY (id)
);
CREATETABLEparents
(
id INT(10) NOT NULL,
name VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
SQL queries
-- name: AllAuthors :manySELECTauthors.id,
authors.name,
parents.idas alias_id,
parents.nameas alias_name
FROM authors LEFT OUTER JOIN parents ON (authors.parent_id=parents.id);
@timstudd, thank you. This fix already enabled me to get rid of a bunch of COALESCE statements.
Unfortunately, it still doesn't work with LEFT OUTER JOINs with the same table. It might be related to #1237.
Activity
Funzinator commentedon Nov 4, 2021
@timstudd, thank you. This fix already enabled me to get rid of a bunch of
COALESCEstatements.Unfortunately, it still doesn't work with
LEFT OUTER JOINs with the same table. It might be related to #1237.I've prepared an example.
Should I open another ticket for that or is it OK to track it here?
Funzinator commentedon Nov 4, 2021
Thank you so much!