Skip to content

Bugfix: event's stream_version can overflow when inserting it in Postgres - #3

Merged
Istar-Eldritch merged 2 commits into
Istar-Eldritch:mainfrom
jpcano:bugfix-version-pg-overflow
Jan 21, 2026
Merged

Istar-Eldritch merged 2 commits into
Istar-Eldritch:mainfrom
jpcano:bugfix-version-pg-overflow

Conversation

@jpcano

@jpcano jpcano commented Oct 14, 2025

Copy link
Copy Markdown
Contributor

It is possible to build a syntactically correct event that, after inserting it in Postgres, is stored with a corrupted stream_version.

This is due to the fact that BIGINT type in Postgres does not deal with unsigned 64-bit integers, plus the fact that we do an usafe type conversion with as. ie. a u64::MAX is converted to -1 (i64).

This fix introduces a runtime-safe type conversion that returns an Err when trying to insert such events.

@Istar-Eldritch
Istar-Eldritch merged commit ab281a8 into Istar-Eldritch:main Jan 21, 2026
4 checks passed
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.

2 participants