Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Postgres oids greater than Int.MaxValue #1086

Merged
merged 1 commit into from
May 9, 2024

Conversation

benhutchison
Copy link
Member

@benhutchison benhutchison commented May 9, 2024

Fix for #1068

//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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accidentally directly pushed a slight revision of the parsing logic in e66ae4f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants