BUG: Unable to bind a null value typed as a UUID in a PreparedStatement
От | Rémi Aubel |
---|---|
Тема | BUG: Unable to bind a null value typed as a UUID in a PreparedStatement |
Дата | |
Msg-id | CAG2M1fdAFD3N8vZxp4TYLEYz4Rwu5f94ghafEErvHv387oWf8g@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: BUG: Unable to bind a null value typed as a UUID in a PreparedStatement
Re: BUG: Unable to bind a null value typed as a UUID in a PreparedStatement |
Список | pgsql-bugs |
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".
See the code here: https://ideone.com/DKnqa9
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.
В списке pgsql-bugs по дате отправления: