JDBC Driver marks Nullable Column as non-nullable
See original GitHub issueHello,
This is my first question here, so apologies in advance if I missed any information and pls let me know if more info is needed.
We have a table with a column defined as such
`my_custom_column` SimpleAggregateFunction(anyLast, Nullable(DateTime64(3, 'UTC'))),
However, when we attempt to write a row with the column set to a null value, we are getting errors and on debugging it seems like the ClickhouseColumn
is set as nullable=false
.
Caused by: java.sql.SQLException: Cannot set null to non-nullable column #1 [my_custom_column SimpleAggregateFunction(anyLast, Nullable(DateTime64(3, 'UTC')))]
at com.clickhouse.jdbc.SqlExceptionUtils.clientError(SqlExceptionUtils.java:73)
at com.clickhouse.jdbc.internal.InputBasedPreparedStatement.addBatch(InputBasedPreparedStatement.java:328)
at com.clickhouse.jdbc.internal.InputBasedPreparedStatement.executeAny(InputBasedPreparedStatement.java:110)
at com.clickhouse.jdbc.internal.InputBasedPreparedStatement.executeLargeUpdate(InputBasedPreparedStatement.java:185)
at com.clickhouse.jdbc.internal.AbstractPreparedStatement.executeUpdate(AbstractPreparedStatement.java:135)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
I am able to insert a NULL
value for the column via the clickhouse client CLI - so this seems like an issue with the Java driver.
More specifically - an error parsing the column definition from the Database.
Can you please help? Thanks!
Issue Analytics
- State:
- Created 10 months ago
- Comments:7
Top Results From Across the Web
JDBC Sqlite trying to get Nullable Columns - Stack Overflow
I am trying to retrieve all nullable columns from an SQLite Database in Java. I don't know why JDBC is returning that only...
Read more >Issues · ClickHouse/clickhouse-jdbc - GitHub
Java client and JDBC driver for ClickHouse. ... JDBC Driver marks Nullable Column as non-nullable bug. #1119 opened on Nov 8 by nym3r0s....
Read more >- Teradata JDBC Driver returns the wrong schema / column ...
columnNullable indicates that a column allows NULL values. columnNullableUnknown indicates that the nullability of a column's values is unknown.
Read more >The Connect for JDBC Greenplum driver returns incorrect ...
The Connect for JDBC Greenplum driver returns incorrect value for a not nullable column or expression.
Read more >Hibernate @NotNull vs @Column(nullable = false) - Baeldung
A quick and practical overview of @NotNull and @Column(nullable = false) in Java.
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
Good point but LowCardinality is simply ignored(because the column only keeps one single value?):
Having said that, I’ve just verified the local changes and it works well 😃
Hi @nym3r0s, thanks for the bug report. For SimpleAggregateFunction, we should use the inner type, so it’s actually nullable column in this case.