Skip to content

Read PostgreSQL metadata in its native types - #357

Merged
serprex merged 1 commit into
mainfrom
less-text
Nov 26, 2026
Merged

serprex merged 1 commit into
mainfrom
less-text

Conversation

@serprex

@serprex serprex commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Queries converted catalog flags, row locations, transaction IDs, and WAL positions to text. Decode binary with FromSql instead.


Note

Medium Risk
Changes how replication-critical metadata (WAL LSN, xids, ctid slots, catalog flags) is read from PostgreSQL; behavior should match but regressions would affect seeding, filtering, and resume positions.

Overview
Sidecar SQL now returns PostgreSQL values in native binary types instead of ::text casts followed by manual parsing.

src/pg.rs adds shared decoding: char_at for "char" columns, FromSql for xid8 and tid, plus next_xid and current_wal_lsn. RawAttr::build() no longer validates single-character strings—it assumes types already decoded as char.

Call sites across bootstrap, catalog tracker, filter engine, introspect/preflight, stream session, shadow catalog, and TOAST landing drop helpers like one_char, parse_ctid, and LSN/xid text hacks. TOAST index lookup uses a bound oid[] parameter instead of interpolated SQL. Integration tests use generic FromSql scalars and Xid8 where appropriate.

Reviewed by Cursor Bugbot for commit af60149. Bugbot is set up for automated code reviews on this repo. Configure here.

Queries converted catalog flags, row locations, transaction IDs,
and WAL positions to text. Decode binary with FromSql instead.
@serprex
serprex requested a review from harshil-goel November 26, 2026 04:03
Comment thread src/pg.rs

/// `"char"` column at `idx`
pub fn char_at(row: &Row, idx: usize) -> char {
char::from(row.get::<_, i8>(idx) as u8)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really we should just return u8 & compare throughout codebase with b'x', but that'll be a separate PR

@security-ai-gate-reviewer security-ai-gate-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved by the AI review gate on af60149. Details in the approver's comment on this pull request.

@security-ai-gate-reviewer

Copy link
Copy Markdown

AI review gate — auto-approved

af60149165fb is approved by security-ai-gate-reviewer[bot], an automated identity, not a human. The approval stands on the required AI review: Cursor Bugbot concluded green on this commit and the AI review gate is SUCCESS (its own comment has the verdict), and the change touches no path that requires a human reviewer. It is bound to this commit: a new push dismisses it and the approver re-evaluates.

History (latest 5 heads, newest first)

  • af60149165fb approved — green: Cursor Bugbot

@serprex
serprex merged commit d532a86 into main Nov 26, 2026
10 checks passed
@serprex
serprex deleted the less-text branch November 26, 2026 04:25
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