Skip to content

Codec preference is not considered leading to OID value decoding through DayOfWeek #693

@turneand

Description

@turneand

Versions

  • Driver: r2dbc-postgresql#1.1.0.RELEASE0
  • Database: v17
  • Java: 21
  • OS: Windows + Linux

Current Behavior

We have some monitoring queries against the pg_stat_activity table and since upgrading to 1.1.0.RELEASE we're now erroring out with the message:

Invalid value for DayOfWeek: 16478

This occurs when reading the values for the "datid" and "usesysid" fields, which are both of the "oid" type

Table schema

n/a - the pg_stat_activity is a built-in table

SELECT * FROM pg_stat_activity

Steps to reproduce

Small snippet of code to read all of the columns from this table based on an existing ConnectionFactory

private static void execute(ConnectionFactory factory) {
  try {
    var result = Mono.usingWhen(Mono.fromDirect(factory.create()),
                                 con -> Mono.fromDirect(con.createStatement("SELECT * FROM pg_stat_activity LIMIT 10").execute())
                               .flatMapMany(rs -> rs.map((row, meta) -> {
                                      return meta.getColumnMetadatas().stream().map(x -> {
                                           try {
                                             var value = row.get(x.getName());
											 return value != null ? x.getName() + "=" + value : null;
										   } catch (Exception e) {
										     return x.getName() + "=" + e.getMessage();
										   }
									  }).filter(Objects::nonNull).toList();
									}))
									.collectList(), Connection::close, (con, t) -> con.close(), Connection::close)
									.block(Duration.ofSeconds(10));
	log.info("success - {}", result);
  } catch (Exception e) {
    log.error("error", e);
  }
}

Expected behavior/code

An oid should not be treated as a DayOfWeek
I can workaround for the moment by explicitly casting the two columns into a "text" type, but this should not be necessary.

Possible Solution

n/a

Additional context

Looks like this was a new capability added under #591

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions