Skip to content

Typecast to nullable type #3698

Open
Open
@quinn

Description

@quinn

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions