r2dbc-postgresql: Row.decode(…) fails for enum type with IllegalArgumentException: 72093 is not a valid object id

Hi, this is a first-timers-only issue. This means we’ve worked to make it more legible to folks who either haven’t contributed to our codebase before or even folks who haven’t contributed to open source before.

If that’s you, we’re interested in helping you take the first step and can answer questions and help you out as you do. Note that we’re especially interested in contributions from people from groups underrepresented in free and open-source software!

If you have contributed before, consider leaving this one for someone new, and looking through our general ideal-for-contribution issues. Thanks!

Problem

AbstractTemporalCodec.canDecode fails as it tries to create a PostgresqlObjectId to verify whether it can decode a timestamp. OID 72093 is a custom type that isn’t known by PostgresqlObjectId and AbstractTemporalCodec.canDecode should not fail, it should rather report that it cannot decode the value by returning false.

As user, calling Row.get(…) leads to:

java.lang.IllegalArgumentException: 72093 is not a valid object id
	at io.r2dbc.postgresql.type.PostgresqlObjectId.valueOf(PostgresqlObjectId.java:417)
	at io.r2dbc.postgresql.codec.AbstractTemporalCodec.canDecode(AbstractTemporalCodec.java:69)
	at io.r2dbc.postgresql.codec.DefaultCodecs.decode(DefaultCodecs.java:128)
	at io.r2dbc.postgresql.PostgresqlRow.decode(PostgresqlRow.java:90)
	at io.r2dbc.postgresql.PostgresqlRow.get(PostgresqlRow.java:77)
	at io.r2dbc.spi.Row.get(Row.java:78)

Solution

AbstractTemporalCodec.canDecode(…) should make use of PostgresqlObjectId.isValid(dataType) before looking up the default type from PostgresqlObjectId. Other codecs such as AbstractCodec are performing the check correctly.

Steps to Fix

  • Claim this issue with a comment below and ask any clarifying questions you need
  • Set up a repository locally following the Contributing Guidelines
  • Try to fix the issue following the steps above
  • Commit your changes and start a pull request.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, please. Please also note that I’ll be back on Aug 31.

Thanks for pointing it out. Fixed it locally. @mp911de Should I push it on the same branch?