diff --git a/modules/core/shared/src/main/scala/util/Typer.scala b/modules/core/shared/src/main/scala/util/Typer.scala index ab2212de..17445324 100644 --- a/modules/core/shared/src/main/scala/util/Typer.scala +++ b/modules/core/shared/src/main/scala/util/Typer.scala @@ -177,7 +177,10 @@ object Typer { case class TypeInfo(oid: Int, name: String, arrayTypeOid: Option[Int], relOid: Option[Int]) implicit class ProtocolOps[F[_]: Functor](p: Protocol[F]) { - val oid: Codec[Int] = Codec.simple(_.toString, _.toInt.asRight, Type.oid) + //Note Postgres defines oids as *unsigned* Ints https://www.postgresql.org/docs/current/datatype-oid.html + //Since Scala currently lacks a built-in unsigned Int type, if the oid exceeds `Int.MaxValue` + //it will be converted to/from a negative Int by this Codec (only observed in CockroachDB) + val oid: Codec[Int] = Codec.simple(java.lang.Integer.toUnsignedLong(_).toString, _.toLong.toInt.asRight, Type.oid) val typeInfoMap: F[Map[Int, TypeInfo]] = {