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 1w6VKP-004Mfc-0Q for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Mar 2026 15:11:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6VKM-00EUV1-27 for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Mar 2026 15:11:55 +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 1w6VKM-00EUUt-0k for pgsql-hackers@lists.postgresql.org; Sat, 28 Mar 2026 15:11:54 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6VKC-00000001VYY-0ja5 for pgsql-hackers@postgresql.org; Sat, 28 Mar 2026 15:11:53 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2b0ba3bfe16so25263735ad.1 for ; Sat, 28 Mar 2026 08:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774710703; cv=none; d=google.com; s=arc-20240605; b=a9Em37Ui3IjH48NgX5fsdcKfcegodHznq5Th5EiudZ1vyxltlSt8qSbR6r0p3hsacJ Nz05VfxG5YZFao94a0NqUFoM1AOMQEl4Qo8ray9zWqrJ9qO05TxPUOzAuvm8VBOTize+ uz5uQ5CFRV9MqtFUohTAPOEvgEJL2W+YRWFr1Zt82edfUR7mbKUaVZPkX7BNlZzZ0s63 rWyzU3DlLsjQlhTzoIh0g4c8HAHUIgsNL85moeS8cAwYmOp1PsCreXbV71xwO7vvaFH2 RiI/yP5hYjVblNkvsl2i6hc/b2Ixxf+ZH7yAT463KDKPzRPBP43xoeI5sdohVRjik6on n0LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=AzJVfvBE9MNwNw9stkGFA/+8jyDNznuhXaLrBNuMvKk=; fh=waPnKahtqrjL6e5lDHONXgAYWW+1/EnTYqDmUsP0vmM=; b=QQtZq6elCA+sc5gsXlZs/eREG642JfBiPq00ky/vATGYMGk5n283Jnkv+eErgr67x1 zPkXBDXoeeR9Qa9st0J7Tm6pzTxa/lcp2TupNTDdDsljvpv+z9tVDXKB96h7QxRrlojC KEiZDkHTnsyh3oidbM/LQIE1RTXKq9H0PH+95ZPkhN4lQTP8WjFoQu1Mf1GK8FHN5RBn NDQYMNC2WOadMgN2dGMWWRL8kVEpP6RAe/ABgHZ9KMKP4399pJNUHO6BCSFiB+BMmqNd Wl//vuuhmlNC68/0QEMS8W/MAw4YW9QJjNGMd31xhc8ME7idxbZODF3LTzChZqAZhzud 9YUw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774710703; x=1775315503; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=AzJVfvBE9MNwNw9stkGFA/+8jyDNznuhXaLrBNuMvKk=; b=ojLiQE+Y/mAk6uD6NeNWUKF4sX5+Pf3b7uzPuqVEx7zdHPhp9uEeDHov1DZQ8rK9+p 7Toj80u9pLnSs7DRRZEOiVBJPG94w/QQrasmyAG2WLW62p+jjtky9fNcKwuO0TduMdVG e8zGdd5i/28gd1YDdq6Yqyn/YiWGj2B6PirICOE6h+BujhWXVMwNZh8chuomm/UpTnjJ kKlsa14nQd881ejid/4ttHVTMMmSO8o36teu/PnEqSoEd/PRIV30J2th2LBiItPmsQ0h pj9JbQbSB+EugZ5Az0bZdsdDDhryyR8lywN5+UlYrz/Ae5dEuX7i6hL0623XxQ0Ybo8N Ug8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774710703; x=1775315503; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AzJVfvBE9MNwNw9stkGFA/+8jyDNznuhXaLrBNuMvKk=; b=WCEsgoYcOrThlKpYQqrf0JtV9GOv3bCWIHfAiuLJ1tOCW4aI1ZBlhh6+cnxztGHulU rBZuoRamcHB2QiLEelH7J0r3Tq+VjSERkFbUwXhPrGy4Tk533XtxqVYB8JdPAKmsinCU 6jX6yDBNzXrPpolV1YS0h6dWVgK+AlDfMVdszRVTKf17BH0gQuDen+sIW6KIzgbbPMSQ sRCTBxQiT3fFTQAxipJM8IaoxhL2RJQHpeOjZK6wGoUa6d5J7pkIbJcArMyvl6ZqIGEP CXr/YHXoWiw0egpoR87XZFNN15WZKQRw4CuPHBW6zWwnZF7CF4Uvw/KQaegt7zr3bKNT CJHA== X-Gm-Message-State: AOJu0Yzx80vPmf8Fa6VaO5bFVpMVrNEVsiO5TYn6Q38D50jl4icCPZBx 3z4fOrdLv2b3hvKIzJ2mCkSD786wPv3VJd+Ux76vM0zTffOSkKBhBuxdgmi5+VhFnintf40Nz4c EVF00ZjHl0g2e5vjnW7NXPH+GvyM2hwM1tTv8cdo= X-Gm-Gg: ATEYQzw957dYmvyXmRTCX1BM17Xi6sdOEjyMnL3h4+oNWiGFciV8LY/1aCwUIj2Wp9N p7ooax0Z8ZEN9lxj5TdFXxdB8VKXPjHba9+dg1YO6b+5Pohf9uOkGV3zYC16KhSfY5FWnugccZe VD6J2i9+Po/i+9hxFthGyLZrJc7HZnjIUpsXQcsN5nLS4cNLeHJiucS8byc8DMkS86BlMeAgQtz wC2N+7KlYJRrjpSztOhEAKPVDdnxP9GYi9Pk48J1KEhA9ZuIirDFZxwLkIVn6wP/ZBaJIcolqFg KJYTf+Tp5KQ7ME3ukQzOM/DO5sFCdSHJpGt+jwDD8oqwCBKOcKdMGryJP+nrhdn5Ev6d70o= X-Received: by 2002:a17:902:ef4c:b0:2b0:501e:d751 with SMTP id d9443c01a7336-2b0ce5b10f3mr56392095ad.20.1774710703405; Sat, 28 Mar 2026 08:11:43 -0700 (PDT) MIME-Version: 1.0 From: Roberto Mello Date: Sat, 28 Mar 2026 09:11:17 -0600 X-Gm-Features: AQROBzDjVW8WIu6gV2xqUjF9LzP3TpbJNuEpuaJMocB6L1Z4dwm5INLTnkAz_3I Message-ID: Subject: PROPOSAL for when publication row filter columns are not in replica identity (BUG #19434) To: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000000e3f5c064e1709fa" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000e3f5c064e1709fa Content-Type: text/plain; charset="UTF-8" Hi all, Tim McLaughlin reported BUG #19434. When a publication's WHERE clause references columns that are not covered by the table's replica identity, UPDATE and DELETE silently succeed at the SQL level but fail with: ERROR: cannot update table "t" DETAIL: Column used in the publication WHERE expression is not part of the replica identity. This error fires at DML time inside CheckCmdReplicaIdentity(), which means the DBA discovers the misconfiguration only when production writes start failing, potentially long after the publication or replica identity was created, and creating a real potentially serious problem of inadvertently disallowing writes in a production system. I have a patch that adds DDL-time WARNINGs (reusing the existing pub_rf_contains_invalid_column() function) so the misconfiguration is reported immediately, but I am wondering if this is the right approach. It's doable and not very invasive, but wouldn't really do away with the potential footgun. It would be an incremental improvement over the current situation where this happens silently (in reporter's case it was a serious production issue). The warnings would fire at: - CREATE PUBLICATION / ALTER PUBLICATION ... SET TABLE / ADD TABLE when the WHERE clause references non-identity columns - ALTER PUBLICATION SET (publish = ...) when the publish set is widened to include UPDATE or DELETE while existing row filters reference non-identity columns - ALTER TABLE ... REPLICA IDENTITY when the new identity no longer covers columns used in an existing publication WHERE clause The existing DML-time ERROR would be preserved as a safety net. The patch would not change the WAL format or remove the underlying restriction. A follow-up patch could extend ExtractReplicaIdentity() to include WHERE-referenced columns in WAL, which would eliminate the restriction entirely. Question being if the incremental and less invasive WARNING approach is the better one given time constraints, or if a more invasive but more complete approach is warranted. Thoughts? Roberto Mello Snowflake --0000000000000e3f5c064e1709fa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

Tim McLaughlin reported BUG #19434.=C2=A0
When a publication's WHERE clause references columns that are no= t
covered by the table's replica identity, UPDATE and DELETE silentl= y
succeed at the SQL level but fail with:

=C2=A0 =C2=A0 ERROR: ca= nnot update table "t"
=C2=A0 =C2=A0 DETAIL: Column used in the= publication WHERE expression is not part
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 of the replica identity.

This error fires at DML time = inside CheckCmdReplicaIdentity(), which
means the DBA discovers the misc= onfiguration only when production
writes start failing, potentially long= after the publication or replica identity
was created, and creat= ing a real potentially serious problem of
inadvertently disallowi= ng writes in a production system.

I have a patch t= hat adds DDL-time WARNINGs (reusing the existing
pub_rf_contains_= invalid_column() function) so the misconfiguration is reported
im= mediately, but I am wondering if this is the right approach. It's doabl= e and
not very invasive, but wouldn't really do away with the= potential footgun. It would be an incremental improvement over the current= situation where this happens silently
(in reporter's case it= was a serious production issue).

The warnings wou= ld fire at:

=C2=A0 - CREATE PUBLICATION / ALTER PUBLICATION ... SET = TABLE / ADD TABLE
=C2=A0 =C2=A0 when the WHERE clause references non-ide= ntity columns

=C2=A0 - ALTER PUBLICATION SET (publish =3D ...) when = the publish set is
=C2=A0 =C2=A0 widened to include UPDATE or DELETE whi= le existing row filters
=C2=A0 =C2=A0 reference non-identity columns
=
=C2=A0 - ALTER TABLE ... REPLICA IDENTITY when the new identity no long= er
=C2=A0 =C2=A0 covers columns used in an existing publication WHERE cl= ause

The existing DML-time ERROR would be preserved as a safety net.=

The patch would not change the WAL format or remove the underlying<= br>restriction. A follow-up patch could extend ExtractReplicaIdentity()
= to include WHERE-referenced columns in WAL, which would eliminate the
re= striction entirely.=C2=A0

Question being if the in= cremental and less invasive WARNING approach is
the better one gi= ven time constraints, or if a more invasive but more complete
app= roach is warranted.

Thoughts?

Ro= berto Mello
Snowflake

--0000000000000e3f5c064e1709fa--