pgjdbc / r2dbc-postgresql

Postgresql R2DBC Driver
https://r2dbc.io
Apache License 2.0
1.01k stars 177 forks source link

Introduce fast-path handling for decoding primitive values #662

Closed mp911de closed 1 month ago

mp911de commented 1 month ago

Right now, PostgresqlRow.get(…) leads to an exception when trying to decode primitive values regardless of whether the value is present or absent. It would be good to handle primitive value decoding in a lenient way and only throw an exception if the value is absent and therefore, cannot be represented.

java.lang.IllegalArgumentException: Cannot decode value of type int with OID 23
        at io.r2dbc.postgresql.codec.DefaultCodecs.decode(DefaultCodecs.java:236)
        at io.r2dbc.postgresql.PostgresqlRow.decode(PostgresqlRow.java:115)
        at io.r2dbc.postgresql.PostgresqlRow.get(PostgresqlRow.java:86)
        at org.springframework.r2dbc.core.BeanPropertyRowMapper.getItemValue(BeanPropertyRowMapper.java:241)