Skip to content

Type int4range/int8range values before insert/COPY#910

Merged
kvch merged 3 commits into
mainfrom
fix/type-integer-range-values
Jun 29, 2026
Merged

Type int4range/int8range values before insert/COPY#910
kvch merged 3 commits into
mainfrom
fix/type-integer-range-values

Conversation

@kvch

@kvch kvch commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

When an int4range/int8range value arrives as pgtype.Range[any], pgx cannot encode it to the binary wire format for the target column (the bounds are untyped any), so inserts and bulk COPY fail.

Fix

Normalize int4range and int8range values from pgtype.Range[any] into typed pgtype.Range[int32] / pgtype.Range[int64] before insert/COPY handling (tstzrange already had handling).


Cherry-picked from @danddanddand (fix/type-integer-range-values).

@kvch kvch requested a review from tsg June 23, 2026 18:11
@kvch kvch marked this pull request as ready for review June 23, 2026 18:11
@kvch kvch enabled auto-merge (squash) June 29, 2026 14:54
@kvch kvch merged commit 6b3bb8a into main Jun 29, 2026
8 checks passed
@kvch kvch deleted the fix/type-integer-range-values branch June 29, 2026 14:55
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgstream/pkg/wal/processor/postgres 79.81% (+0.59%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgstream/pkg/wal/processor/postgres/postgres_wal_dml_adapter.go 94.06% (+0.38%) 202 (+28) 190 (+27) 12 (+1) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/xataio/pgstream/pkg/wal/processor/postgres/postgres_wal_dml_adapter_bulk_test.go

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