public inbox for [email protected]
help / color / mirror / Atom feedFrom: Chao Li <[email protected]>
To: PostgreSQL-development <[email protected]>
Subject: Question: should we block loopback logical replication to the same database?
Date: Tue, 7 Apr 2026 16:26:26 +0800
Message-ID: <[email protected]> (raw)
Hi,
While testing a patch today, I tried to set up logical replication on the same cluster. Although I have done that many times before, I made a mistake this time: I accidentally ran the CREATE SUBSCRIPTION command in the source database session, and the subscription was created successfully:
```
evantest=# CREATE SUBSCRIPTION mysub CONNECTION 'host=localhost dbname=evantest user=repl password=secret' PUBLICATION mypub WITH (create_slot = false);
CREATE SUBSCRIPTION
```
After that, something weird started to happen. The destination table was empty, but the logs kept reporting duplicate-key errors. It took me a while to realize that the problem was this mistake.
This made me wonder whether we should block this kind of loopback logical replication to the same database. I am not aware of a way to use different destination table names, so this setup does not seem useful. Blocking it could help prevent this kind of unnecessary mistake.
Before working on a patch, I wanted to check with hackers first. If there are no objections, I can propose a patch. Please let me know if I am missing something.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Question: should we block loopback logical replication to the same database?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox