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 1vIngZ-00EqhL-1H for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 12:41: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 1vIngV-0064tR-2u for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 12:41:19 +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 1vIngV-0064tI-1T for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 12:41:19 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIngS-0079n5-3B for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 12:41:19 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2953ad5517dso42368665ad.0 for ; Tue, 11 Nov 2025 04:41:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762864874; x=1763469674; 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=lmyJ32fAhBjqszPBvTg8G9OAOgL0Hr6K6os36MLKupU=; b=c9luT+JIdEc/aT8Tc58ul//lUzg79sVb+Fuup7eYNQUecnCOQ8eCaA11giqX0x7awc GxTqcVD+R5gT/voKjMm+S3Y6InT1063ftiT8W/kArCE+wHPQumCWpjq5gtFZjiXJ1Oa5 76xdbZX1SnG3yf0UDm1v3VEECLQWSblJMt75c7vs0wnP/nvpn49Kgrj+h2SdtEoP/sWS Hdc+RkqV/IMQPlPZVP8poMx6Pz5WK2t9q9sX0E1ORqvDNmtkusGDWAKlJNmNzsqBI++C sAmdC2bQcmhvAyKYiaNCcrtKvKfrNXuifHreet8VXSA7PCOYEN9c1C/uxwQzakN0KFV+ d/Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762864874; x=1763469674; 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=lmyJ32fAhBjqszPBvTg8G9OAOgL0Hr6K6os36MLKupU=; b=PPmgwnuekyr5PTEhzLHHUFCBmJvul3ceff+v0ZbwPxADW2w9Ux7ZhyGJu20BixC1wX /A9Me3h0/nwu5aNuRlJOsodqbHFnBrQFwWhMVAKF+XuRz5IkCvLcXVgdJTyFA2nKg70n P+EIDmcC+tANNscwCrhc9PTlwn0Fi+DNTIyVb+a8uG/tYO1dLefMGdJu8GEsOpQEJpcJ p/WLRDgYtIX2SnAmNqHlZuRFNBxf5QspPhl9py758ROrEgEqy21y7wW9N+cN+A2TnKJY R5nbbhj1Z4suxXC2lC6Ek7JMalQWFAnL1U3rBU1hCYT9hCOHac9QVuyleQO607hzPnU5 WZvw== X-Gm-Message-State: AOJu0Yxa6S+M+TkGxYv9YJDz3mpXsBGICR9ylMrGM0JwDgsIe7Xc1+BD PdQYovfd5js283rUVjk6BzlGVbtiXfJqa1HC4n8QdUbOQGuvSGrHjIzX+a/vh1kKhTs= X-Gm-Gg: ASbGncu9g30H0TsU1FVAt9RZ96I4tElx+mq1siKnJqDcY/T7mV58rKai8syZwmjrTEz OojDdm/VNwV/3z4rv+u8p/eJLdF5N+tTjGoQ3gDWzR75fE3A95RFJV6fEMqxVeYRDD0drdajkrO QLy7p1ZPqoIn2utG0DBfm7xH0s3AFfqxfvzz/CT8H5QL/OGRZfkaxYwf5m78syyfCJ81jm04gSx 5sUMLqkxd9WqxC8EZrHjjVRYAzf1pEXj8sg3mwrcveT9UoBhD93mmmRjR7U748HC4xZlO/LJjid LR1lHWeDHzOlpJmKf7hhVRwEtligE09198LF2XxjmfZ3VV5XrWM/2e5PKQq4G8nKZL5Wf7NoI4r lcMu5TEqsOOxG7SedZ6oUR6DEcYGhiq4FRjOrgmD0ht5oBq9vh56V0VnYFUKaKfjgDAFXALRI7P hG3dk6jz/beUhOPP/zHYsj X-Google-Smtp-Source: AGHT+IH4Ko64zoqMwY5zxLT+nXKGshPCvdEt0kqWTZdx0LFuLCp4YbtN/KDldp0wsm0IKh7Z+Xj3gQ== X-Received: by 2002:a17:903:983:b0:295:64f8:d9cd with SMTP id d9443c01a7336-297e562481bmr155695895ad.15.1762864874250; Tue, 11 Nov 2025 04:41:14 -0800 (PST) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7b0cca5fd74sm15101704b3a.58.2025.11.11.04.41.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Nov 2025 04:41:13 -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: Tue, 11 Nov 2025 20:40:39 +0800 Cc: Postgres hackers Content-Transfer-Encoding: quoted-printable Message-Id: <5ABD7727-CD22-4112-A186-0E788EE78109@gmail.com> References: To: Amit Kapila X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Amit, Thanks for asking. > 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 Yes, UPDATE/DELETE will fail. That=E2=80=99s the easy case to expose the = error. Actually my patch will allow the update/delete. However, some tables, like dictionary tables, they are important, but = don=E2=80=99t have much update/delete, they may silently fail to = replicate. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/