Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wA1mA-001zu3-2Z for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 08:27:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wA1m8-00FmUG-37 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 08:27:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wA1m8-00FmU7-2A for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 08:27:09 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wA1m6-0000000101Z-3pl3 for pgsql-hackers@postgresql.org; Tue, 07 Apr 2026 08:27:08 +0000 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-35d99bae2ebso4064646a91.3 for ; Tue, 07 Apr 2026 01:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775550425; x=1776155225; darn=postgresql.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=jvIIUJcukiojPLIrazCi+qiu5MNdTUAveawrJ1aTk/E=; b=GJLpLbjknKJebbNCT3yi7+OmWXXADCBQ+X4zd157fLJQs3IXzGVI2QaCyK4ynXowO+ 4kcKE2Ikof2crwD5/uo1oNWh30tvtmZkfoJXhAMSMk53DvdMkoruu8u2BaYyX7ABOEIU QKUrBmggKSHIs7nYMneK3RJkhQSp+fvr6Rpu3oVHhK+1n/H8i37decQ4id8Cp+NGzxU3 d0KxLmGxMRcBUGNDNhjGNNJdmRJ3NLwGwPjlDU0KCxcVGBWPatWV9BDtR+Vxp8phcGif dZR0TJUWenF8YCBRR+/Y4jtW/wfNq0eNySM/mIej4I02ZK5r7XauAMMDg0gWY/E+csuw eOTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775550425; x=1776155225; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jvIIUJcukiojPLIrazCi+qiu5MNdTUAveawrJ1aTk/E=; b=dM0MS1RvkF0iXKlsHNUoH4MKST8lIqbqSlu12fLBYEOqZPrx9QAOjBCTCA6JJyA9mA iXgb9bJxbhEL9SqhrqaCDTKHXg5D0pEGKgNLh1hh+B5mFWJNrsIcESm6AailY6cggw0o 9ESxnsMHrzAhDEwxWDN/1xHRcDV1Orq3EtTen0qU7W5mPOVcgzR09DAZtPUdpxGiSm+/ RTJCnmByDeAeueod4hbA+10KnjIuDWwv3ThccFllZrVcJgelj67GCpPBzHfG54CiXBGn pAhu9AfPGmhEztnT94OY+89ZPOV9yv+hq27EpghRgMGIOGeglbchiRfzCepKIZ1lV23W Eixw== X-Gm-Message-State: AOJu0YwcrMbenaeb+APjEvQNvMu0WyM03U5r3O8Iye9X6t2l0vI9MEe+ BVurJYo91lWiueyzYy/sIjPzsr/vPynqqMk/7TyM9dUF/mpJEiU2Mt02uL4z21KHHx9cag== X-Gm-Gg: AeBDieuLbndKwdA+26rPqLxphWxt5nPoYt5N5CIwlHGj3zh+sR5FQh4+KRkDDahH3P+ VJhyCC9ErHy1agmzYz9ZwVr73p0HyBKpLL0SR4e2uL//xyFjMFeggndsn/b9Ixi84nJU9bOQn8l 1J3BROl+zHpH92evAezoNk8QJPmwzmgZw1S0NbVdhhtcDRo1Mop1gbXwqRpESgGkZcPW3D4imu8 3Y8K3IdvMy/d+10FBS7y/qSBUp4Gqpwzw7/xL4GsvVC1gHUY6bgqvV5uiPKQ2XlABUOZIwopt6y QTNCFMA7P/dyKq8+Q0fGVFBNq0gANIP5xPJSc/KxmiTFwHXlJMpAbvpPz72BzrjZ+UZY6x+Y8ne ulPEnypFMZirRsieKrbqhxcYbUswxqFPSBCeierLWn9Ax4KMHrrhSy0OZo3Nrxo2QoThKgXvVME LVqKUu8/zpEXBBdVksVuxOdZE9Gx4Wft8= X-Received: by 2002:a17:90b:58f0:b0:35b:9ab6:1d4b with SMTP id 98e67ed59e1d1-35de68f2cbemr15176742a91.20.1775550425352; Tue, 07 Apr 2026 01:27:05 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35dbe624756sm26894244a91.5.2026.04.07.01.27.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2026 01:27:04 -0700 (PDT) From: Chao Li Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Question: should we block loopback logical replication to the same database? Message-Id: <25C3F6A7-DC52-48AE-B43C-0D8665CAB74A@gmail.com> Date: Tue, 7 Apr 2026 16:26:26 +0800 To: PostgreSQL-development X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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=3D# CREATE SUBSCRIPTION mysub CONNECTION 'host=3Dlocalhost = dbname=3Devantest user=3Drepl password=3Dsecret' PUBLICATION mypub WITH = (create_slot =3D 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/