Re: Allow logical replication in the same cluster

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: Allow logical replication in the same cluster
Date: 2025-09-11 10:58:35
Message-ID: CAA4eK1JguoT0JDw8MAhOX9dRe4qXGR0g_gBUiiR9qfpW4vaj_g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 8, 2025 at 8:20 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> Hi Amit,
>
> Thanks for your info.
>
> On Sep 6, 2025, at 12:32, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> You can avoid this problem by creating a slot first on publisher with
> something like:
> postgres=# select pg_create_logical_replication_slot('s1', 'pgoutput',
> false, true);
> pg_create_logical_replication_slot
> ------------------------------------
> (s1,0/01BFF178)
> (1 row)
>
> Then while creating subscription you can use the above created slot as follows:
> db1=# create subscription sub1 connection 'dbname=postgres'
> publication pub1 WITH(create_slot=false, slot_name='s1');
> CREATE SUBSCRIPTION
>
> --
> With Regards,
> Amit Kapila.
>
>
> I am aware of this workaround solution. When I encountered the “create subscription” stuck problem, I did a Google search, then I found the old discussion thread that mentioned a workaround, so I did further search and eventually figured out the workaround.
>
> I think it’s worth resolving this issue, because it avoids confusion from people who want to try or test logical replication logically, and allows the same script to run in both an pure local environment and a real non-local environment. WDYT?
>

I don't see why someone can't use the workaround provided. The
solution proposed is more like adding hacks in the code making it a
maintenance burden.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-09-11 11:36:14 Re: pgsql: Introduce pg_shmem_allocations_numa view
Previous Message Greg Burd 2025-09-11 10:56:07 Re: [PATCH] Add tests for Bitmapset