When left joining two (or more) tables, where the selected values are embedded into structs using sqlc.embed, an error occurs when the joined table row is empty. The error states cannot scan NULL into *decimal.Decimal or in other cases *string. I think that this occurs because the columns are marked as NOT NULL in the schema, leading to sqlc thinking it can never be null. I would prefer that the struct be nil/zero valued.
Version
1.25.0
What happened?
When left joining two (or more) tables, where the selected values are embedded into structs using
sqlc.embed
, an error occurs when the joined table row is empty. The error statescannot scan NULL into *decimal.Decimal
or in other cases*string
. I think that this occurs because the columns are marked asNOT NULL
in the schema, leading to sqlc thinking it can never be null. I would prefer that the struct be nil/zero valued.Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
https://play.sqlc.dev/p/39c1fb54f9c5b0816d0fd0aee51053bfbe0541b8882a71e2ae42e03d02b9978b
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go