Bird
0
0

Given a publication created with

medium📝 query result Q4 of 15
PostgreSQL - Advanced Features
Given a publication created with
CREATE PUBLICATION pub1 FOR TABLE employees;
and a subscription created with
CREATE SUBSCRIPTION sub1 CONNECTION 'host=publisher' PUBLICATION pub1;
What will happen if a new row is inserted into employees on the publisher?
AThe new row will be replicated only if the subscriber manually requests it
BThe new row will be replicated to the subscriber's employees table
CThe new row will cause an error on the subscriber
DThe new row will not be replicated because subscriptions do not sync inserts
Step-by-Step Solution
Solution:
  1. Step 1: Understand logical replication behavior

    Logical replication sends inserts, updates, and deletes automatically to subscribers.
  2. Step 2: Analyze the scenario

    Since the publication includes employees table and subscription subscribes to it, inserts replicate automatically.
  3. Final Answer:

    The new row will be replicated to the subscriber's employees table -> Option B
  4. Quick Check:

    Inserts replicate automatically = The new row will be replicated to the subscriber's employees table [OK]
Quick Trick: Inserts replicate automatically if table is in publication [OK]
Common Mistakes:
  • Thinking inserts require manual sync
  • Assuming replication causes errors on insert
  • Believing subscriptions do not replicate inserts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes