ResultSet getObject with class return null values filled as it was not null
See original GitHub issueWhen selecting values from table with getObject(index, Class) simple types (like float/int/boolean) return 0/false as result (when null is expected).
CREATE TABLE db.tbl
(
id int not null,
double_col double,
float_col float,
varchar_col varchar(36),
boolean_col boolean,
int_col int,
bigint_col bigint,
char_col char(10),
int32_col int32
primary key (id)
)
distributed by (id)
Expected: [1, null, null, null, null, null, null, null, null]
Actual: [1, 0.0, 0.0, null, false, 0, 0, null, 0]
getObject(int columnIndex) returns null as expected.
Is that expected behaivor? (it breaks Vertx jdbc client as it always uses getObject with expected class)
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Checking for a null int value from a Java ResultSet
Unfortunately, getObject(columnName, Class) does not return null, but the default value for given Java type, so 2 calls are required
Read more >ResultSet.getObject() Returns Null Wrongly If Using JDBC OCI
ResultSet.getObject() or ResultSet.getString() return null or empty although a valid value is stored in a table. This issue is reproduced ...
Read more >java.sql.ResultSet.wasNull java code examples - Tabnine
Gets the value of a column specified by column name, as an intvalue. close. Releases this ResultSet's database and JDBC resources. You are...
Read more >JDK-4029237 JDBC Problems with NULL Data ... - Bug ID
When I get a ResultSet back from a query, problems occur if a column contains null and the columns are not access in...
Read more >ResultSet - Android Developers
A table of data representing a database result set, which is usually generated by executing a ... If the value is SQL NULL...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zhicwu dbeaver probably using getObject(index) to retrieve column values simple reproducer:
Yeah, that seems strange to me too, why would they do that if it perfectly worked with getObject(int), I made an issue for them too to get their idea behind this change.