sqlc-dev/sqlc-gen-kotlin

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

Toru-Takagi opened this issue · 1 comments

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.

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.