Skip to content

repr/strconv: accept full u32 range when parsing oid from text#37440

Open
def- wants to merge 1 commit into
MaterializeInc:mainfrom
def-:pr-oid-cast
Open

repr/strconv: accept full u32 range when parsing oid from text#37440
def- wants to merge 1 commit into
MaterializeInc:mainfrom
def-:pr-oid-cast

Conversation

@def-

@def- def- commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

parse_oid parsed OIDs as i32 and reinterpreted them as u32, which rejected valid OIDs in 2147483648..=4294967295. For example '4294967295'::oid errored even though 4294967295::oid succeeded, and COPY into such a column failed with "invalid input syntax for type oid".

PostgreSQL accepts the union of the u32 and i32 ranges (negatives are reinterpreted), so parse the full u32 range directly and fall back to i32 for negative inputs.

Found via #34779

`parse_oid` parsed OIDs as `i32` and reinterpreted them as `u32`, which
rejected valid OIDs in `2147483648..=4294967295`. For example
`'4294967295'::oid` errored even though `4294967295::oid` succeeded, and
`COPY` into such a column failed with "invalid input syntax for type oid".

PostgreSQL accepts the union of the `u32` and `i32` ranges (negatives are
reinterpreted), so parse the full `u32` range directly and fall back to
`i32` for negative inputs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@def- def- requested a review from a team as a code owner July 3, 2026 22:21
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.

1 participant