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 1wFmun-005Y4v-2Y for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 05:47:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFmun-00HKvO-01 for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 05:47:53 +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 1wFmum-00HKv8-1d for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 05:47:52 +0000 Received: from ss11.activegate-ss.jp ([202.241.206.41]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wFmuj-00000002Mnh-0iZY for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 05:47:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifull.com; s=20260316104901; t=1776923269; bh=ReWBTSohlEKA0QU+dNmLfkti3PVjr2l58AXcicLNNjA=; h=References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc; b=YT+AC/Frrcw9TxuVHDYxT/acYaMMABNXqXGJbRpWoT8dSPXQm6bdvHS26GWzp4+8l N8tMydV60XSbRqM4ovZ67fy9jtyB0yIMnnmlM3qc+IF3I4zeEFe8ShajdYxHGbVJPJ qpxtfePiFpid8DYvcyd6xEsTjma0M7d+8zV8pJoY= Authentication-Results: ss11.activegate-ss.jp; dkim=pass header.d=lifull.com Received: from mail.activegate-ss.jp (agproxy-out16.ariake.ss.jp [10.16.39.37]) (envelope sender: ) (not using TLS) by ss11.activegate-ss.jp (Active!gate) with ESMTP id XOvI19354B; Thu, 23 Apr 2026 14:47:10 +0900 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-5a4181690c2so3869250e87.3; Wed, 22 Apr 2026 22:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776923227; cv=none; d=google.com; s=arc-20240605; b=K5osRGd/0ESsStdoF+qxpR/QcAVfjadfL9HsXkbLwJW8c2i/CALgwNhQguRipaonJQ QSR/iqm0EKBYjQhM6SWs7frov22u6v9r8FjuizBUeVHfZr+/Y2KzXNhfLIn+6a9AbFwi o4uo8nVBikyYJpcmqz2rQJONSQENgNmGwi902a0M2gbVjOX/DF/LziV8Xgf9j7zBiZDk lWStLuZK+kgz83IOQjj2h3i4F59ELEtYd1Ki6kIfBtMd4r6T4mOesf8+CbB8d1DXMQ1L PGkvHkKmBiJR0DQhAlOyUoW36wOzR1nY9gknOoN1WlY5Va62uzEHlutJ+OsGwI+18N/n oV3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ReWBTSohlEKA0QU+dNmLfkti3PVjr2l58AXcicLNNjA=; fh=odqrUm5KLm2PJraWZmAxalxS1GHZB/iTe1LHWwZr9KE=; b=HN+Hc7nLiv6s7TrnezgRpe6zF0mTUGCirqkMcar9xFtHc+CQpqKY66e0QQY9MUeU1n rpm+rKDB3Hca6gMMCLUrK+gxPN1KLiwgXipLF9ry5EEjt2hSRkVzq9E+Gsl6ZfKFlpXy K6/LJZNqqfddqu1WQZf+/BaJRdTtT0B9nde3rpDuFo7wKUnQu75/uvg+DNVNKP9wAmzR JHDJ3ohYLbibxiqN3iP1yaQJ4N4MX6bmRG5eFtMlEie47uqiJQVgvk2jpjISDEgU94qG XIR3ynup74apBCIreAF5JymQs05Fig2j+S87dY1By4mXPuymsZIJ04STU9wwO8ob8oL1 e7WA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifull.com; s=google; t=1776923227; x=1777528027; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ReWBTSohlEKA0QU+dNmLfkti3PVjr2l58AXcicLNNjA=; b=bnOpBmZA3btcqFybRXb4+64sSxNH3kGEGQA6jAq1C8wVKwFIoo+7MPYK+Ejg8W73hw nh5+qwe2ek4Bj8cRAgbrFJ+6lNsOn9VVZf4jcYKWt/aRZXih65X3SuhylACFF5TgT6dK Gl84KUx3MvLCQc6EAjA7u7rllGtxqO6g21PWFYJsHvnz+1DFerbo3vR8RDuagznVdVcE PDoKf/wVVp3Eq0phV+Sokq8+YfkY1iuLklr0Ou0qWfogLpvyQhzaPCXiLd0/x3J89Rof vaD9XntZ9KjdQ48JdpxTda05I64r0EnVrK3HNjQJQD0Y1DgazAX0ablvsQEbhdpEBUDo w7Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776923227; x=1777528027; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ReWBTSohlEKA0QU+dNmLfkti3PVjr2l58AXcicLNNjA=; b=gEyVPQzu0BKZVt5XOx+EORYQo8SsOVCU4TyAZG7ny5NaYl3NcMSH5Uz4RsbSGGzCs4 Jb69R4p+v0/DeVDJ8WKu4Q4VgRIzc1x554XU5gZ1cqASuuuigL60hNWGdJQlMavz2jI5 H6FAWilwCVVudEmFZrfmi/FU9+j3WPWDdKQLyxt+g4VGinOiz2aQzVkbUybpA4K4Mu4z uEpmNGgzNnqVPDgklsqqQs6QsrlVnrpHKlhfXPtokYsc7/EJHUk2yIkg8DmRQuMhGMZg l7K58eTD0NkuPGNsszuhV6CUXrl428C0OjzXUQitjRtjXFHFBLRprCGQ/dkgk0OnQDcC yKzQ== X-Gm-Message-State: AOJu0Yzlo4Ezkk8BiBD7r0NRxpt2Szwrszy5jqRdDfpy2zKeSKqwiEzz IftVi8y669pM32WEqbfOXd39J83NVb5IdFqP0KkmZctDzV87Wtfa4AyWMwgsuFvMRHuHfxTn4lO tKkeFHZx/jUnyKaNFTKcVnxbTBI8vSzYWaJd41b37IHu+4RMaT26e/KulOVM3jFYE1w5eRuDOWS KrPThAr8h4wADxwq+KrTs3CwKvpV4Vsh1oHJ9FlObYRYRZHdVnfvnIpwunnlmBQqSh/ql/R8mDu LeuAiVNVwuU X-Gm-Gg: AeBDietZqP3d7F9sb+FZCpU5Mpd4ilJjcO8ekYdDRWTOSI2hJ9lucODq1FkSPoT0sbb ODdm7n6dXBpg7CC+3Zzv/kV496Z7AosT+Mpbpx1dfmzDgIbQud4AILUjlYtj2vop2rcht8URmJ8 xD5RPYWyzzLPbhanGeht2mazNVOc10ssK3jW9eHhjjeQAFijRA2aJjY2h58w4ieEwMQktxpZCd4 +YlmGS3P69YIpvJ/CE= X-Received: by 2002:a05:6512:3d22:b0:5a3:f0a6:da67 with SMTP id 2adb3069b0e04-5a4172c34f7mr10526739e87.13.1776923227173; Wed, 22 Apr 2026 22:47:07 -0700 (PDT) X-Received: by 2002:a05:6512:3d22:b0:5a3:f0a6:da67 with SMTP id 2adb3069b0e04-5a4172c34f7mr10526725e87.13.1776923226652; Wed, 22 Apr 2026 22:47:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?5Y2X5ouT5byl?= Date: Thu, 23 Apr 2026 14:46:53 +0900 X-Gm-Features: AQROBzDLbj2MC8xuZF_k7xwXoJOH0JqAbldV9qOzKAXgR6bmuyBw4u2mPfIYDww Message-ID: Subject: Re: Warn on missing replica identity in CREATE/ALTER PUBLICATION To: shveta malik Cc: pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk # Reply draft v2 to Shveta --- Hi Shveta, Thanks for pointing out that thread. I've read through it carefully. I believe the two proposals address different aspects of the same problem: - The fallback RI approach changes runtime behavior so that tables without a primary key can still replicate UPDATE/DELETE. - This proposal simply warns at DDL time that a publication contains tables whose replica identity will cause UPDATE/DELETE to fail at replication time. A WARNING at publication creation time is useful regardless of whether a fallback mechanism exists, because: - If a table has REPLICA IDENTITY DEFAULT with no primary key, it silently falls back to NOTHING. Combining that with a publication that publishes updates/deletes is guaranteed to fail at runtime. A WARNING at DDL time closes this gap. - Even users who explicitly set REPLICA IDENTITY NOTHING and add the table to an update/delete publication would benefit from a reminder, since that combination cannot succeed. - The WARNING does not change any existing behavior =E2=80=94 it only makes the misconfiguration visible earlier. Notably, Euler mentioned in that thread [1] that he would "suggest a way to disallow or add a warning message while creating the publication or adding new tables", which is exactly what this proposal does. That said, I see the two proposals as complementary. Should I continue this as a separate thread, or would it be better to join the existing discussion? I have a working patch covering all publication paths (FOR TABLE, FOR TABLES IN SCHEMA, FOR ALL TABLES, ALTER PUBLICATION). Happy to post it either way. [1] https://www.postgresql.org/message-id/a9da608f-24be-4213-a712-8592852d3= 7f1%40app.fastmail.com Best regards, 2026=E5=B9=B44=E6=9C=8822=E6=97=A5(=E6=B0=B4) 12:33 shveta malik : > > On Tue, Apr 21, 2026 at 11:06=E2=80=AFAM =E5=8D=97=E6=8B=93=E5=BC=A5 wrote: > > > > Hi hackers, > > > > CREATE PUBLICATION silently succeeds even when target tables lack a > > usable replica identity, while the publication publishes UPDATE and/or > > DELETE. The error only surfaces later at replication time: > > > > ERROR: cannot delete from table "foo" because it does not have a > > replica identity and publishes deletes > > > > This gap has caused real production incidents =E2=80=94 in one case, a = CDC > > pipeline using FOR TABLES IN SCHEMA included a table without a primary > > key, and replication stalled for hours before the cause was found. > > > > I'd like to propose emitting a WARNING at publication creation/alter > > time when this mismatch exists. The check would cover all paths: > > > > - CREATE PUBLICATION ... FOR TABLE / FOR TABLES IN SCHEMA / FOR ALL TAB= LES > > - ALTER PUBLICATION ... ADD/SET TABLE / ADD/SET TABLES IN SCHEMA > > - ALTER PUBLICATION ... SET (publish =3D 'update, delete') > > > > The approach I'm considering is a publication-level check that runs > > after the final publication state is known, scanning the effective set > > of published tables via GetIncludedPublicationRelations() / > > GetAllSchemaPublicationRelations() / GetAllPublicationRelations() and > > checking each table's replica identity. > > > > I have a working prototype for the FOR TABLE / ADD TABLE paths. A few > > open questions before I post a full patch: > > > > 1. For FOR ALL TABLES, the check would scan pg_class. Acceptable for > > a DDL operation, or too expensive? > > > > 2. Should we cap the number of warnings when many tables are affected? > > > > 3. Should this be controllable via a GUC, or is a simple WARNING > > sufficient? > > > > Thoughts welcome. > > > > Before we dive deeper into this idea, I=E2=80=99d like to highlight that > there=E2=80=99s an ongoing thread addressing a similar issue. The propose= d > approach there is to implement a fallback RI in such scenarios to > prevent replication-time errors caused by missing RI. Could you please > review this ([1]) and confirm whether it meets your requirements? > > https://www.postgresql.org/message-id/flat/CAEoWx2mMorbMwjKbT4YCsjDyL3r9M= p%2Bz0bbK57VZ%2BOkJTgJQVQ%40mail.gmail.com > > thanks > Shveta --=20 =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81 =E3=81=82=E3=82=89=E3=82=86=E3=82=8BLIFE=E3=82=92=E3=80=81FULL=E3=81=AB=E3= =80=82 =E6=A0=AA=E5=BC=8F=E4=BC=9A=E7=A4=BELIFULL =E3=83=86=E3=82=AF=E3=83=8E=E3=83=AD=E3=82=B8=E3=83=BC=E6=9C=AC=E9=83=A8 = =E4=BA=8B=E6=A5=AD=E5=9F=BA=E7=9B=A4U =E3=83=97=E3=83=A9=E3=83=83=E3=83=88=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0G =E5=8D=97 =E6=8B=93=E5=BC=A5 minamitakuya@lifull.com =E3=80=92102-0083 =E6=9D=B1=E4=BA=AC=E9=83=BD=E5=8D=83=E4=BB=A3=E7=94=B0=E5= =8C=BA=E9=BA=B9=E7=94=BA1-4-4 =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81