I need to bind a UUID parameter which may be null in a statement like "select * from test table where ? is null or ? = c_uuid".
Whatever approach I use, the driver rejects my request with "ERROR: could not determine data type of parameter $1".
When run, it gives the output below:
JDBC Driver Version: 42.2.1
PostgreSQL version: PostgreSQL 9.5.9 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609, 64-bit
setNull(varchar) + setObject(null) => works
setNull(other) + setNull(other) => fails (ERROR: could not determine data type of parameter $1)
setNull(other, uuid) + setNull(other, uuid) => fails (ERROR: could not determine data type of parameter $1)
The third case (last line above) uses method PreparedStatement.setNull(pos, type, typeName) and should work.
But in the current implementation of the driver, the PreparedStatement.setNull(int, int, String) delegates to setNull(int, int) so that specifying the type name has no effect.
--