Skip to content

Return bigint from compressed_data_column_size#9710

Open
svenklemm wants to merge 1 commit intomainfrom
sven/compressed_data_column_size
Open

Return bigint from compressed_data_column_size#9710
svenklemm wants to merge 1 commit intomainfrom
sven/compressed_data_column_size

Conversation

@svenklemm
Copy link
Copy Markdown
Member

The function summed the byte size of every value in a compressed batch
into an int32 accumulator and returned int32. A batch can hold up to
1000 rows, and for wide varlena columns (large text, jsonb, bytea) the
sum can pass 2 GB, at which point the accumulator silently wraps and
the function reports a wrong size.

Switch the accumulator and return type to int64 so the full per-batch
size is preserved. The SQL function signature changes from INTEGER to
BIGINT, so the upgrade and downgrade scripts drop the function before
the new version is created.

The in-tree caller in size_utils.sql wraps the result in sum(), which
keeps working unchanged.

No regression test is added: triggering the overflow needs more than
2 GB of varlena data in a single batch, which is too resource intensive
to run as part of the normal test suite.

The function summed the byte size of every value in a compressed batch
into an int32 accumulator and returned int32. A batch can hold up to
1000 rows, and for wide varlena columns (large text, jsonb, bytea) the
sum can pass 2 GB, at which point the accumulator silently wraps and
the function reports a wrong size.

Switch the accumulator and return type to int64 so the full per-batch
size is preserved. The SQL function signature changes from INTEGER to
BIGINT, so the upgrade and downgrade scripts drop the function before
the new version is created.

The in-tree caller in size_utils.sql wraps the result in sum(), which
keeps working unchanged.

No regression test is added: triggering the overflow needs more than
2 GB of varlena data in a single batch, which is too resource intensive
to run as part of the normal test suite.
@svenklemm svenklemm requested a review from a team May 2, 2026 12:00
@github-actions github-actions Bot requested review from antekresic and melihmutlu May 2, 2026 12:01
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

@antekresic, @melihmutlu: please review this pull request.

Powered by pull-review

@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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