Open bradenrayhorn opened 5 months ago
Did you manage to work this out?
@seonixx I have not found a solution, other than avoiding sqlc for this query.
+1 hope can solve it soon.
@bradenrayhorn I now use COALESCE
to solve this error
-- name: GetEmployees :many
SELECT employees.id, COALESCE(managers.name, '')::text as manager_name
FROM employees
LEFT JOIN employees as managers ON managers.id = employees.manager_id;
Version
1.25.0
What happened?
Using the schema and query below, I would expect the
manager_name
column to be nullable because themanager_id
field is nullable. However, when sqlc generates types for this query theManagerName
field is not of a nullable type, it is a normalstring
.Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/d731813577e3c62ea17d31608ffef113dfe47303ad5c5c6618824802d74bff0b
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go