-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Currently there are 2 methods to bind a null value, one is
Statement bindNull(int index, Class<?> type);And the other is
Statement bindNull(String name, Class<?> type);Normally these work fine but there is a interesting corner case/ambiguity when it comes to JSON like values (I am using postgres specifically) where its not possible to distinguish between a column being null vs the json value being null.
With the current API its only possible to the latter, i.e. if you do
bindWithNull(null, Json::class.java)This will always insert the value as a JSON null (which means in SQL if you do WHERE my_column is NOT NULL it won't work, you have to check for JSON null). Its however impossible to insert the value as a proper postgres NULL value (even if the column is nullable). Attempted workarounds such as
bindWithNull(null, String::class.java)don't work since the desired column is of type JSON. Is there any way around this or does it require adjustments to the API?