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 1vUzNl-00BAGk-2T for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 03:36:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vUzNk-00FGhj-1z for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 03:36:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vUzNk-00FGha-13 for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 03:36:21 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vUzNi-000n6o-1Z for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 03:36:20 +0000 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7f121c00dedso3717873b3a.0 for ; Sun, 14 Dec 2025 19:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765769776; x=1766374576; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xjkSKp1GupMJaedJY2igr7OJiRlkaABtaB+eC986ZiE=; b=hH3qUd4rgu+brQ3/bTqYYgmllj85K5oPMfNP0cG/+P56FOcApN4EdhgwBIWmOQNym1 kZ5UNfnNI75SmSKqUtarw6LtYxttUSRK89FXDI+K86alsvEBG3XFSo++N2oxV7rEi7YZ 0UnwPsM50rsVUrZl9gtmjtQhBmpWO5fDiExwz3YF61cX7DBgauO92ivnVJvgcXGwWXS3 1naaa2Jg0T3v3VZTxfXFQIhzY1n+PQDEYjqQPynQG/q7jwettLyT2XOfigiwUATihGLg 4/aJv4MlKu7ZoaPXNfAMYClB05vvy1nPiWUM6V6rube4YFfV152bF8EXOrDki0t4BZ04 /+YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765769776; x=1766374576; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=xjkSKp1GupMJaedJY2igr7OJiRlkaABtaB+eC986ZiE=; b=UUqbFVAmFuYAFLf7WDzetaGrL8POfvfSoFgojCFZ78OQfSIHXKfA8EDMoqMJoYg1PM W8gyrgoNLwVYUQQA6I+YugO6U3neC6tYV/0jNJV+13rceHiygnYqKs/7TUxxIxZrNOub y4ibejGyQoTq8ErXWyDk2eGGhDPpGAtPkusdUJDhd8xzsfcRtcFV/D68iyijQ9nbDhRP Cgdi1d9m+UAAovYqM0EzrLmgtWjpOgrq63uoIyo+LvVXzl+PsYoJmaTsBhOjPtVdUO2H CKQdK8PbauszkGHEtw6y3Id8DRQUHUUcxnt1pmghvnvBlQjNkQDChEuPpGhWqwJLMYlG B5CA== X-Forwarded-Encrypted: i=1; AJvYcCVEYOY3guM6wGxe73RF/6kZObF5M+oIH/BiPcgaS/CUiL/ud6EGQa2Ja8iNXwBxgnAwQFkIiur5PelDdLUj@lists.postgresql.org X-Gm-Message-State: AOJu0YyU4vfRt8eCLJ/S6SE+Ci3sBXcR5PMhN6GZ5WBKFMjckq4mGXrQ gP/lI37fPh07cg9vRdFU9NrzT/9hs914vUz3xTzcqL6ufJRlUkeyYfnQmeYNLZJa X-Gm-Gg: AY/fxX4yVzdbifAdb/p+SQNoze+VxYj9woXv9JYigRWf9ptivQXtTOMMmjmLl0UVuV7 3PQYr3jfH8CoU00DgxCEJwgsN7o1rkGPySDOmX8TPPE4hPOSgMPrMG9NA0HkexkzijVzRvQq9RH V76vsCRPobzrPLFZ3dbPoZZTpKK/QQXcA59XZ5Y6X+sduZT/Xpppw81ZBnyUOWVmGQrHuDGW6Vv TBDgILrshiLY+uBLzYMDdrgOuFuu5au4pLbMy1BRgF918jdrtbEXHFLkl/88hkhFHUaK8j490Hp Aq9F+InNmW2bQJZifFK9QldClTM2xSWUo1Xtduu00uj4hi1yo0dAJIod2S/1103awfPDz34SuT3 KntOTpInnLBqUllJm8IgJ22Yv3cPBj0SW4zjB8p5D2dlfUr0l8B3uwglagMcsZQnNAMDSyCzsvP DdjMbqXCiCi3SL7pPs2ps= X-Google-Smtp-Source: AGHT+IEwrOAKNiKl+Et23so9dz8t+oJCmpPuUj26omNaLgAW/AauQ8XOkkXi84SoLh4phu+gCSPAKg== X-Received: by 2002:a05:6a00:600d:b0:7a2:8853:28f6 with SMTP id d2e1a72fcca58-7f667936901mr10495307b3a.22.1765769776037; Sun, 14 Dec 2025 19:36:16 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7f4c49b0dabsm11059336b3a.42.2025.12.14.19.36.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Dec 2025 19:36:15 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: Improve logical replication usability when tables lack primary keys From: Chao Li In-Reply-To: Date: Mon, 15 Dec 2025 11:35:36 +0800 Cc: Amit Kapila , Postgres hackers Content-Transfer-Encoding: quoted-printable Message-Id: <23A24BFF-18A7-4FE9-AAFA-13E1AA207DD0@gmail.com> References: <5ABD7727-CD22-4112-A186-0E788EE78109@gmail.com> To: Dilip Kumar X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 15, 2025, at 11:28, Dilip Kumar wrote: >=20 > On Tue, Nov 11, 2025 at 6:11=E2=80=AFPM Chao Li = wrote: >>=20 >> Hi Amit, >>=20 >> Thanks for asking. >>=20 >>> On Nov 11, 2025, at 19:18, Amit Kapila = wrote: >>>=20 >>> On Mon, Nov 10, 2025 at 1:36=E2=80=AFPM Chao Li = wrote: >>>>=20 >>>> * BACKGROUND >>>>=20 >>>> This requirement comes from several users operating large = deployments, particularly in HIS (Hospital Information Systems). The = situation can be summarized as follows: >>>>=20 >>>> - A central DB operations team maintains the main database and = configures logical replication for all tables. >>>> - Multiple third-party application vendors are allowed to create = new tables in that database. >>>> - Some of these newly created tables lack a primary key. Since = logical replication with `REPLICATION IDENTITY DEFAULT` requires a = primary key, such tables silently fail to replicate. >>>> - The DB operations team must then spend significant effort = identifying the affected tables and correcting them manually. >>>>=20 >>>=20 >>> Can you share an example of how we silently fail to replicate? Won't >>> in such cases UPDATE/DELETE will anyway raise an ERROR? >>>=20 >>=20 >> Yes, UPDATE/DELETE will fail. That=E2=80=99s the easy case to expose = the error. Actually my patch will allow the update/delete. >>=20 >> However, some tables, like dictionary tables, they are important, but = don=E2=80=99t have much update/delete, they may silently fail to = replicate. >=20 > But other than UPDATE/DELETE for what operation we need RI, I mean > INSERT would work without any RI and UPDATE/DELETE will fail on the > publisher itself without setting RI, so can you explain the exact case > where it will silently fail to replicate? >=20 > --=20 > Regards, > Dilip Kumar > Google Hi Dilip, Thanks for asking. When fallback to FULL, UPDATE/DELETE will be allowed = in the publisher side. In my first email, attached v1 patch is a PoC = that has implemented the logic. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/