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

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

Open
Toru-Takagi opened this issue Feb 7, 2024 · 1 comment · May be fixed by #21 or #22

Comments

@Toru-Takagi
Copy link
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.

@ichizero
Copy link

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
Labels
None yet
Projects
None yet
2 participants