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

Typecast to nullable type #3698

Open
quinn opened this issue Nov 9, 2024 · 0 comments
Open

Typecast to nullable type #3698

quinn opened this issue Nov 9, 2024 · 0 comments

Comments

@quinn
Copy link

quinn commented Nov 9, 2024

What do you want to change?

            CASE
                WHEN t.amount = 0 THEN null
                ELSE t.price - t.amount
            END AS delta,

This gets typed as an empty interface.

            CASE
                WHEN t.amount = 0 THEN null
                ELSE (t.price - t.amount)::float
            END AS delta,

I get this error cannot scan NULL into *float64

This gets typed as a float64 when what I want is pgtype.Float8. Is there a workaround for this?

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

@quinn quinn added the enhancement New feature or request label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant