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 1vfboW-003LQz-16 for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jan 2026 10:39:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vfboU-004Ecm-30 for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jan 2026 10:39:51 +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 1vfboU-004Ece-1v for pgsql-hackers@lists.postgresql.org; Tue, 13 Jan 2026 10:39:50 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vfboS-000CQ3-0a for pgsql-hackers@lists.postgresql.org; Tue, 13 Jan 2026 10:39:50 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-38310ee9d40so36628991fa.1 for ; Tue, 13 Jan 2026 02:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768300787; x=1768905587; 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=PHG3KFilyhXeCeitN3JHINn3dzkwye4tc+LIjbh7XIY=; b=AfEiDMpa/RAkzd3VP9akL+FTRXBfiMw6eCnbAlmeqDURAasfhQVVk1gfkN7D3WkIex CU28G3Cno6z2seBqFCjnZJ/qAIjJUZQlK58qZhqmKHorcZn+vXwOHBr9mkuDU/ovaZgO 3XMT44k4+MlUQDKsXIoEUaC7U0Ju3b8GwlSmQjeg2V/lTFZpVUHWWkWtoze+fHy0CLqb Rx7nn+1viJHkdxA6DWrP8dWiBYcV83TyG5ZEVNtr/AGopHW0K8dB7JgoR3hFU5oDgAgs R3sGu6j+K4RPTM5ub/2uT+8uEzFfkehWj/na+CTIsKcHVkqCdp8XGbytI/Dwzc6NP1sf Su2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768300787; x=1768905587; 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=PHG3KFilyhXeCeitN3JHINn3dzkwye4tc+LIjbh7XIY=; b=FI96SQeMqfw2Xmp6HgOmbmAVM/TQYkeKKaeNWLAD/FENg+AqlHaBybA/a2r4Iscubf v7O3M/ktiEuagCCewSXywB27PtdVygpccEeB5hpkoueZhv1t8Hg+Q49Jw4X2UYjnleyc k+oHSci8SDjD1PqcJvfIqbuAdJz6SsRSyCxaV96Ppdq/JKExP0xjwaFmtGMZOx13Yab2 LjD9tytcSLUz0FbAlx1smKiXyllySNcHMti6mCRDTFTObCN9EZK5c/AjU+jWgGkVT0ZK 7WdSqVwkk1VXHTuwvFXJU0j0nDqQtb+tOMbXPV2mq96uFva6Dwe/UE7cXyeZsm94EvzJ ok3g== X-Forwarded-Encrypted: i=1; AJvYcCWePpNTpuqhph5zEOtiab16stUHeBj9B5gVkB8EGUdPoyNtX80MwfeSLtbQ/Vr9x2zT9RW1FtDNjZz0g1fz@lists.postgresql.org X-Gm-Message-State: AOJu0YzNil1FhQmc56YsZ0NHXCDREIvdGbh7Qh25ODgIN2kM7o034kmO 2ogShNdHlAbyeq5zG5DfMuaXJkFKNQEeMSTfm+H5Riq6ifMNBr/Rf0S/6YdqheM7xwlO1I5iQ1z n4reR9RbQMJ7Qr0lkxr9NkdLl2ilNzUI= X-Gm-Gg: AY/fxX4foNCv7pae1cKCdqzAnCsc2sqfI5/QZsPJjL5nQ+GkwWuym20zZW5DL1wEEJA 0XMV2Y41SoFIx2b6Hq4MYcJfdBDTL4bKTdUDOFSiSTyXIHUuyOUKS1XdzBeLQjl4kH3oTn2SHwl iYQKGdlVXNqfcdDKCH7MelsGARb4IUCRzTblDk5mG0HngN+syCOG27GLeTrgMGFLvqb/rBeGHJX QiZwXpuAEIJ74FdCcI+gWEImZ3vOoD5qEyH8+PHA/FjRPm8R6Z2zokhogjk0Hb/sBP34/E= X-Google-Smtp-Source: AGHT+IEFbSmFm4XbuDuzcdbBgP3GqZfo3PyXoXyXmjjd7M+4AAvOeWdAe9F73shDOvJMjhSi+g7JNeTJjLxgSAGHvj0= X-Received: by 2002:a05:651c:30c9:b0:36e:93a3:979d with SMTP id 38308e7fff4ca-382ff6b08cbmr59405871fa.19.1768300786742; Tue, 13 Jan 2026 02:39:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dilip Kumar Date: Tue, 13 Jan 2026 16:09:30 +0530 X-Gm-Features: AZwV_QjGImzESi9zE3hNdi8RPPQlrOIiBc-wNvqgi21lF02WE1KSHdT9BKAdbIg Message-ID: Subject: Re: Proposal: Conflict log history table for Logical Replication To: shveta malik Cc: Peter Smith , vignesh C , Amit Kapila , Masahiko Sawada , Bharath Rupireddy , PostgreSQL Hackers 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 On Tue, Jan 13, 2026 at 3:59=E2=80=AFPM shveta malik wrote: > > On Sat, Jan 10, 2026 at 6:45=E2=80=AFPM Dilip Kumar wrote: > > > >> > > Here is the updated patch > > > > Thanks, I will review the code. Few concerns while experimenting with 001= alone: > > 1) > I am able to insert and update rows in pg_conflict.pg_conflict_16394. > It should be restricted. > > 2) > I think we need to block 'SELECT for UPDATE' and similar operations on > CLT. Currently it is allowed on CLT. > See this: > > postgres=3D# SELECT * FROM pg_toast.pg_toast_3466 for UPDATE; > ERROR: cannot lock rows in TOAST relation "pg_toast_3466" > postgres=3D# SELECT * FROM pg_conflict.pg_conflict_16394 for UPDATE; > .... I sent an analysis on this a few days ago but realized it only went to Amit. Resending to the full list: So the summary is, currently, all INSERT/UPDATE/DELETE operations are blocked for TOAST tables for safety. However, I have allowed these operations for the pg-conflict table. Unlike TOAST, the system does not internally reference conflict data, so user manipulation doesn't pose a safety risk to the system. If a user modifies or deletes this data, they simply lose their logs without impacting system stability. What are your thoughts on this approach? >> I Wrote > I have been exploring the enforcement of these restrictions. > Currently, DML is validated via CheckValidResultRel(). If we do not > explicitly check for the conflict log table in that function, DML > operations, including DELETE, will be permitted. While I am not overly > concerned about users attempting manual INSERT or UPDATE operations. > Now for TRUNCATE, the truncate_check_rel() currently relies on > IsSystemClass() to restrict truncations. Since the conflict namespace > is included in IsSystemClass() to prevent unauthorized DDL, TRUNCATE > is blocked by default. We could allow it by adding an exception in > truncate_check_rel() (e.g., IsSystemClass() && > !IsConflictNamespace()), but I am unsure if this is necessary. Do we > really need to permit TRUNCATE, or is allowing DELETE sufficient for > user-driven cleanup? > > > 3) > We currently skip ANALYZE on TOAST tables, but I=E2=80=99m not sure wheth= er > the same restriction should apply to CLT. Since users are expected to > query CLT frequently, collecting statistics could be beneficial. Even > though there are currently no indexes or other structures to enable > more optimal plans, having statistics should not harm. Thoughts? > > postgres=3D# analyze pg_toast.pg_toast_16399; > WARNING: skipping "pg_toast_16399" --- cannot analyze non-tables or > special system tables > > postgres=3D# analyze pg_conflict.pg_conflict_16394; > ANALYZE I think its good to ANALYZE CLT data because user logically never need to query the toast data, but they would have to query the conflict data. > 4) > It will be good to show 'Conflict Log Table:' in \dRs command. Yeah, you raised this point earlier as well, somehow I am missing this point from the last few versions. I will analyze this and change this as a first comment in the next version. --=20 Regards, Dilip Kumar Google