Skip to content

Add a way to tell sqlc to always use nullable type when casting #3782

Open
@quinn

Description

@quinn

What do you want to change?

for example:

select null::float8 is a pgtype.Float8. However,

    select CASE WHEN true THEN null
    ELSE 0 END::float8,

is a float64. I'm basically having to do a bunch of weird stuff in sql to get sqlc to give up and codegen an interface{}, which sucks, but at least does not panic. And then I cast it at runtime to the correct type.

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