Closed tsegismont closed 2 months ago
Originally reported in #1281
As an example, if the query has a parameter of type interval, mapped by io.vertx.pgclient.data.Interval, and the user puts a java.time.Duration, then PgClient will set the value to NULL.
interval
io.vertx.pgclient.data.Interval
java.time.Duration
NULL
It happens here:
https://github.com/eclipse-vertx/vertx-sql-client/blob/cc9803f073f4f7ca7717e97f20d8fdc810ff32ab/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/codec/PgParamDesc.java#L53-L62
We would expect the client to reject the query using a message generated by buildWhenArgumentsTypeNotMatched.
buildWhenArgumentsTypeNotMatched
But the INTERVAL data type is defined without a type extractor:
INTERVAL
INTERVAL(1186, true, Interval.class, JDBCType.DATE),
So the client invokes values.get(paramDataType.encodingType, i);
values.get(paramDataType.encodingType, i);
And there the returned value is null because Interval is not assignable from Duration:
Interval
Duration
https://github.com/eclipse-vertx/vertx-sql-client/blob/2de7f0dd3b1719c5ab5523f85cc7507c9ec1ac1d/vertx-sql-client/src/main/java/io/vertx/sqlclient/Tuple.java#L1716-L1719
Fixed by #1464
Originally reported in #1281
As an example, if the query has a parameter of type
interval
, mapped byio.vertx.pgclient.data.Interval
, and the user puts ajava.time.Duration
, then PgClient will set the value toNULL
.It happens here:
https://github.com/eclipse-vertx/vertx-sql-client/blob/cc9803f073f4f7ca7717e97f20d8fdc810ff32ab/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/codec/PgParamDesc.java#L53-L62
We would expect the client to reject the query using a message generated by
buildWhenArgumentsTypeNotMatched
.But the
INTERVAL
data type is defined without a type extractor:So the client invokes
values.get(paramDataType.encodingType, i);
And there the returned value is null because
Interval
is not assignable fromDuration
:https://github.com/eclipse-vertx/vertx-sql-client/blob/2de7f0dd3b1719c5ab5523f85cc7507c9ec1ac1d/vertx-sql-client/src/main/java/io/vertx/sqlclient/Tuple.java#L1716-L1719