Repository navigation
Accept InsertMessage with zero-column tuples - #86
Merged
Merged
Conversation
PostgreSQL emits zero-column tuples for inserts into tables with no replicated columns: tables created with no columns, tables whose columns have all been dropped, and (before PG 18) tables with only generated columns. The payload is then 7 bytes (relation ID, 'N', column count 0), but InsertMessage.Decode required at least 8, so decoding failed with "InsertMessage must have 8 bytes, got 7 bytes" and a replication stream could not progress past such a change. The in-stream InsertMessageV2 check had the same off-by-one (12 instead of 11).
ilidemi
added a commit
to PeerDB-io/peerdb
that referenced
this pull request
Oct 9, 2026
Include jackc/pglogrepl#86 to support zero-column inserts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgreSQL can have tables with no replicated columns: created that way initially, columns dropped later, or only generated columns. InsertMessage payload for those is 7 bytes long (4-byte relation ID, 'N', 2-byte column count of 0), but InsertMessage.Decode fails with
InsertMessage must have 8 bytes, got 7 bytes.This is an arguably questionable case to try and replicate, however there can be a situation where a publication is created for all tables, only a few are actually being consumed in CDC/replication downstream, then an unrelated table creation/modification breaks a running pipeline without a way to recover. UpdateMessage and DeleteMessage already support zero-column tuples.
InsertMessageV2 check had the same off-by-one (12 instead of 11), also fixed here. Added tests for both cases.