Skip to content

feat(data): manage Postgres Advanced logical replication - #3902

Merged
eablack merged 17 commits into
mainfrom
logical-replication
Sep 29, 2026
Merged

eablack merged 17 commits into
mainfrom
logical-replication

Conversation

@jdowning

@jdowning jdowning commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Add commands to enable logical replication publishing and subscribing on Postgres Advanced databases.

Add publication list, info, create, update, and destroy operations with table and schema scoped targets. Include --all-schemas as an opinionated setup path for all current customer schemas, while making its non-continuous behavior explicit.

Resolve and reject non-Advanced databases before contacting the Data API, preserve destructive confirmation for publication removal, and cover the command flows with unit tests.

Type of Change

Breaking Changes (major semver update)

  • Add a ! after your change type to denote a change that breaks current behavior

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Patch Updates (patch semver update)

  • fix: Bug fix
  • deps: Dependency upgrade
  • revert: Revert a previous commit
  • chore: Change that does not affect production code
  • refactor: Refactoring existing code without changing behavior
  • test: Add/update/remove tests

Testing

Notes:

❯ heroku data:pg:logical-replication:publications postgresql-justin-animated-23578 -a justin-lr-test
  Name      New Tables     Owner            Target
 ───────────────────────────────────────────────────────────
  onepub    included       ubitise4r2c94d   schemas: one
  testpub   included       ubitise4r2c94d   schemas: public
  twopub    not included   ubitise4r2c94d   tables: two.foo
  
❯ heroku data:pg:logical-replication:publications:info --name testpub postgresql-justin-animated-23578 -a justin-lr-test
Name:                testpub
Owner:               ubitise4r2c94d
Target:              schemas: public
Current Tables:      public.bar, public.baz, public.foo, public.pgbench_accounts, public.pgbench_branches, public.pgbench_history, public.pgbench_tellers, public.test
Includes New Tables: yes

Steps:

  1. Replace this text with a list of steps used to validate changes or type 'Passing CI suffices'.
  2. ...

Screenshots (if applicable)

Related Issues

GitHub issue: #[GitHub issue number]
GUS work item: W-24080815

@michaelmalave michaelmalave left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few comments below:

@michaelmalave michaelmalave left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dev Tools Standards Review Results (machine-generated)

@michaelmalave michaelmalave left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dev Tools Standards Review Results (machine-generated)

🟡 0 advisory.
🔭 4 design-lens advisory (whole-PR; never blocks).

Comment thread src/commands/data/pg/logical-replication/publications/index.ts
Comment thread src/commands/data/pg/logical-replication/publications/update.ts Outdated
Comment thread test/unit/commands/data/pg/logical-replication.unit.test.ts Outdated
Comment thread test/unit/commands/data/pg/logical-replication.unit.test.ts Outdated

@michaelmalave michaelmalave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some small updates requested with a few findings.

@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:44 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:44 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:44 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:44 — with GitHub Actions Active

@jdowning jdowning left a comment

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.

Submitted the three follow-up responses after rebasing the branch onto current main.

@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:51 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:51 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:51 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 22, 2026 21:51 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:27 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:27 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:27 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:27 — with GitHub Actions Active
@github-actions github-actions Bot added the size/L Large PR (code churn < 1000) label Sep 23, 2026
@michaelmalave

Copy link
Copy Markdown
Contributor

Including for record, this was the full test suite run to confirm functionality and errors. All completed within expectations confirming functionality.

npm install
npm run build

All commands run via the compiled ./bin/run (dev mode ./bin/dev.js throws .ts.ts resolution errors).

  1. Enable publishing & subscribing

./bin/run data:pg:logical-replication:publishing:enable $DB -a $APP
./bin/run data:pg:logical-replication:subscribing:enable $DB -a $APP

Wait until enablement finishes before creating publications — poll with:

./bin/run data:pg:info $DB -a $APP # wait for it to settle (~2.5 min first time)

  1. Create publications (+ validation errors)

schema-scoped

./bin/run data:pg:logical-replication:publications:create $DB --name orders_pub --schema public -a $APP

all-schemas

./bin/run data:pg:logical-replication:publications:create $DB --name all_pub --all-schemas -a $APP

negative: both --schema and --table → should error

./bin/run data:pg:logical-replication:publications:create $DB --name bad1 --schema public --table public.orders -a $APP

negative: no target flag → should error

./bin/run data:pg:logical-replication:publications:create $DB --name bad2 -a $APP

  1. List & info

./bin/run data:pg:logical-replication:publications $DB -a $APP
./bin/run data:pg:logical-replication:publicars_pub -a $APP
./bin/run data:pg:logical-replication:publications:info $DB --name all_pub -a $APP

  1. Update

./bin/run data:pg:logical-replication:publications:update $DB --name orders_pub --all-schemas -a $APP

  1. Destroy (note: --confirm takes the APP name)

wrong confirm → rejected

./bin/run data:pg:logical-replication:publications:destroy $DB --name orders_pub --confirm WRONG -a $APP

correct confirm (app name) → destroys

./bin/run data:pg:logical-replication:publications:destroy $DB --name orders_pub --confirm $APP -a $APP
./bin/run data:pg:logical-replication:publications:destroy $DB --name all_pub --confirm $APP -a $APP

  1. Alias check (data:pg:lr:*)

./bin/run data:pg:lr:publications $DB -a $APP

  1. Advanced-tier gate (against a non-Advanced DB)

./bin/run data:pg:logical-replication:publications DATABASE_URL -a general-test-app

→ Error: You can only use this command on Advanced-tier databases.

@michaelmalave michaelmalave left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Validation completed and full set of commands + functionality validated (see prior comment). This is approved.

@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:13 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:17 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:17 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:17 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:17 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:27 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:27 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:27 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:27 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:34 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:34 — with GitHub Actions Active
@jdowning
jdowning deployed to AcceptanceTests September 25, 2026 20:34 — with GitHub Actions Active
jdowning and others added 17 commits September 28, 2026 19:54
Add commands to enable logical replication publishing and subscribing\non Postgres Advanced databases.\n\nAdd publication list, info, create, update, and destroy operations\nwith table- and schema-scoped targets. Include --all-schemas as an\nopinionated setup path for all current customer schemas, while making\nits non-continuous behavior explicit.\n\nResolve and reject non-Advanced databases before contacting the Data\nAPI, preserve destructive confirmation for publication removal, and\ncover the command flows with unit tests.
Consume publication collection responses through items, count, and limit\nand read individual publications directly from the response body.\n\nAdd data:pg:lr aliases for logical replication enablement and\npublication management commands.
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
Co-authored-by: Helen Cheng <48834224+heicheng18@users.noreply.github.com>
Signed-off-by: Justin Downing <justin@downing.us>
@heroku-johnny heroku-johnny mentioned this pull request Oct 1, 2026
5 tasks done

This branch was successfully deployed

1 active deployment
AcceptanceTests — bd63a1d0 Deployed Sep 29, 2026 by jdowning via acceptance (22.x, ubuntu-latest) #9350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE! size/L Large PR (code churn < 1000)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants