Skip to content

Is it a specification for sqlc that retrieving null from a nullable boolean column in Postgres results in false? #20

Open
@Toru-Takagi

Description

@Toru-Takagi
Contributor

When creating a boolean (nullable) column in Postgres.

When generating code from SQL that retrieves this column, it becomes results.getBoolean() .
Reading ResultSet.java, it states

"Returns: the column value; if the value is SQL NULL, the value returned is false."

Ideally, if the table contains null, I would like it to return null.

I would like to hear the maintainer's opinion on this.

Activity

ichizero

ichizero commented on Feb 17, 2024

@ichizero

Thanks for creating the issue! We are facing the same problem.

I think it would be better to follow the implementation of java.sql.ResultSet.getObject rather than doing the implementation for each types in sqlc-gen-kotlin.
I've created a PR and would appreciate your consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @Toru-Takagi@ichizero

      Issue actions

        Is it a specification for sqlc that retrieving null from a nullable boolean column in Postgres results in false? · Issue #20 · sqlc-dev/sqlc-gen-kotlin