Conversation
📝 WalkthroughWalkthroughAdds three new Perl test scripts validating lolor large object behavior across different PostgreSQL configurations. Tests cover dump and restore functionality, streaming replication between primary and standby clusters, and logical replication between publisher and subscriber clusters. Changes
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
t/003_dump_restore.pl (1)
30-44: Consider extracting a helper for repeated LO read SQL blocks.The same
BEGIN; lo_open; loread; END;pattern appears multiple times; a local helper would reduce duplication and future edit drift.♻️ Optional refactor sketch
+sub read_lo_text +{ + my ($node, $loid) = `@_`; + return $node->safe_psql('postgres', qq( + BEGIN; + SELECT lo_open($loid, 262144) AS fd \\gset + SELECT convert_from(loread(:fd, 1024), 'UTF8'); + END; +)); +} + -$result = $src->safe_psql('postgres', qq( - BEGIN; - SELECT lo_open(1, 262144) AS fd \\gset - SELECT convert_from(loread(:fd, 1024), 'UTF8'); - END; -)); +$result = read_lo_text($src, 1); is($result, 'lolor LO object - 1', "Verify first LO content on source");Also applies to: 64-90
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@t/003_dump_restore.pl` around lines 30 - 44, Extract a small helper to reduce duplication around the repeated BEGIN/lo_open/loread/END SQL pattern: create a function (e.g., read_lo_content) that accepts the PgNode $src and an OID or LO ID, builds and calls $src->safe_psql('postgres', ...) with the same block that does SELECT lo_open(... ) AS fd \\gset and SELECT convert_from(loread(:fd, 1024), 'UTF8'); then replace the two direct calls that currently invoke $src->safe_psql in the test with calls to read_lo_content($src, 1) and read_lo_content($src, 2); ensure the helper returns the same string value so existing is(...) assertions for "Verify first LO content on source" and "Verify second LO content on source" keep working.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@t/003_dump_restore.pl`:
- Around line 30-44: Extract a small helper to reduce duplication around the
repeated BEGIN/lo_open/loread/END SQL pattern: create a function (e.g.,
read_lo_content) that accepts the PgNode $src and an OID or LO ID, builds and
calls $src->safe_psql('postgres', ...) with the same block that does SELECT
lo_open(... ) AS fd \\gset and SELECT convert_from(loread(:fd, 1024), 'UTF8');
then replace the two direct calls that currently invoke $src->safe_psql in the
test with calls to read_lo_content($src, 1) and read_lo_content($src, 2); ensure
the helper returns the same string value so existing is(...) assertions for
"Verify first LO content on source" and "Verify second LO content on source"
keep working.
Add TAP tests for lolor dump/restore, streaming and logical replication
Summary
003_dump_restore.pl: verifies lolor large objects survivepg_dump/psqlrestore to a fresh instance, and that new objects can be created after restore
004_streaming_replication.pl: verifies lolor objects created both beforeand after standby setup are accessible on a hot standby via physical streaming
replication
005_logical_replication.pl: verifies lolor objects replicate to asubscriber via logical replication, covering both initial table sync and
ongoing WAL streaming