Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot embed empty row into struct #3123

Open
erendogan51 opened this issue Jan 10, 2024 · 1 comment
Open

Cannot embed empty row into struct #3123

erendogan51 opened this issue Jan 10, 2024 · 1 comment
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@erendogan51
Copy link

erendogan51 commented Jan 10, 2024

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 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.

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

@erendogan51 erendogan51 added bug Something isn't working triage New issues that hasn't been reviewed labels Jan 10, 2024
@anthonybishopric
Copy link

#2997 is related or the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that hasn't been reviewed
Projects
None yet
Development

No branches or pull requests

2 participants