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 1wPs4l-0016B9-1d for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2026 01:19:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPs4j-008ubN-1R for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2026 01:19:50 +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 1wPs4j-008ubF-0Q for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2026 01:19:50 +0000 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wPs4h-00000000dcA-3Y8W for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2026 01:19:49 +0000 Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-50e5eb0fabaso67978741cf.0 for ; Wed, 20 May 2026 18:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779326386; cv=none; d=google.com; s=arc-20240605; b=Q8l8BEKlJVfplcxLiglByKjr2fenJimCxIy1w+ryX4uLhf0nEalKi7MKovVOgiEkMF km7Bs3XtiQt2iWEdH7hXTkixjA5rHghEQCSHpCIeAkW5QHqvl8ODeXnNPNT+Z7RFOGpj 7wGYvJRYBcAl9FjB5cOqyBvSCpKFpycBOH8DGVoCv9k/CUOL/mk+JPudjCepeD70aZJk yAew4ATf1UxIGWFF6dFUYFQZymPl7Z+7ZmivsPwQql4MmMgh/x2PZrGZgj67339Wz3pK G+IF8FB6coYQfHUUWJG7vj4OBCfQbqAq/MHuG1UcefMsDIFogCaCDOc0+zZ8lVIicpOZ c1zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=N8UM0KVX5JK8ErlZxDQUPdTKCJCEHR5o0DUB2JpbxfM=; fh=vxc2dm3wMiMGPgcQVXHAH+k4LWyS00Qs5KV+HkSH1pM=; b=c18XJB0w4KTQ45k0QJt8aCwdi11U1d5eZeSZlfDyJHE7cy09+lti2QgkkTeOkcmkLg QSTZQkBdJBWfNHEEhp5911tmM6FeVU7e0mEMq8cG0vTbxxNpNqEyQINFeBgGO0gMlGFa vC+5t2aCy12MYotXYx8wzs8eCoZEJdzHeHfyvxxQmYbH3fJ2Qc/J7szJegbCXFxqj/AU yrxdnLjO8kpM6nfK50DCWKIu75wscL+w0az0/1lmp5t5UNHKlmX27j2v+GTGwHHWtsIy ZrcBnX7aecw1/OAmEMTopZJfEz/TD37DWwwfYSkD2rRoaZsl3WYJNiF6Lv50OfK0UBud 4JkQ==; 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=gmail.com; s=20251104; t=1779326386; x=1779931186; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=N8UM0KVX5JK8ErlZxDQUPdTKCJCEHR5o0DUB2JpbxfM=; b=UDz4nNpY/7foH4eX0Y55S+9JmCeN3fcO58reMthjv9Evaqc+0m8JHYQFiBndAW7JHX 7QQwmUECilohx0BimfU+hFgl/ZMWW14J1DawdEgV9rRpIq9qy7AW9ooxBiPfTHmxLcBh MCv67caKp71uQe9uFGPbRZ3xeZ4veIBAajajHDzg5gO79he+cvuB+CTBzDPBZ1l9BTID RnsZi3JHUdOfMYBi4Hm14WXOMU9zxSF/9BQGC4sxijmbBe/hDQGBaSggxEXbQF8j6C0k dzvQxEqEtD7MA7L7LVNC0KoZWjwh2m2O0n+0JNP2s9gsTpWcCwqc3Jywk5vPEm+qWJBq xfqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779326386; x=1779931186; h=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=N8UM0KVX5JK8ErlZxDQUPdTKCJCEHR5o0DUB2JpbxfM=; b=RmJ8lJ+y1/LZoitVKd48tvlDaLUlCjkDeksPLr3HgaQVR8VFZsjYg6o0vu5WSb+QVo hR3AXl709lCe16ICGKLR44beveaikIn01gd3lExoFKdtM2EVNP+nMvarVFB19WclU/C7 x/tAy7Dy8FCKIbf3X0O9uW0yL7ednVeHvZpH0QeeaYBNkRpBg4NKqk57YqB4HLO9HUoH dficujG/1ElALM2Lejc25XGNuiMpiR/e4dXMFMV8qFBk5lFaL6W3xfPelqXuYCSEtyJH WlqNxZTPhCOEGXqCcKSrwk8Kfp6i6DZWCVSswOm3cnjBSNAO6swQfcONwtucsfhYuF3A KYRA== X-Forwarded-Encrypted: i=1; AFNElJ/XRgc2GIEC65tl0z018ZZJSquUi119pOTmL2P26/Cdigw24QYEtAJWTNTmg1u6oo3Ov3CUof8sgWt7vRBS@lists.postgresql.org X-Gm-Message-State: AOJu0YzjXsITpZDMiiQUfB2Q+8CKMYHfs8TNL7ve70DvZYu+DS4Qw806 3JDuxfjCHojrafyKaRKReovnBsyRHhYWJgcdUE7ny2RsEHisk+P8gycQ89vevREMbaOlFHz4yxu nmpvJP406ya17HP03WR34NK/SYBLGF40= X-Gm-Gg: Acq92OGlvBJyzlg7kA7wBCKi3eAMggKAdc81ayVcMb1xl7LFQ4ntoerp1Q2y9a8TG+w WD/N4Sms313P1YWnIGEHPzGJC4H04Rr2TnzGT0HXijr7w1c32QWousxc7aP+62qvcJv26nfoJQ7 RcpT8xyiMNR5JHnsSyQtndtdm/WHXbp5SopqJL/9Rdwk+gsHAkjHIOQ+fBAUV1ir+1+1J8mZPFC Gll3BY5XvaJHNlQXZs/aTYx6dxfUQqNF5OulQfAQ7r9diJHT0vsAF/9uXdmZQhMtJNnySYB9Fns MCPnPwY= X-Received: by 2002:a05:622a:1e0b:b0:50e:fcbc:6b82 with SMTP id d75a77b69052e-516c5451932mr13608791cf.15.1779326386262; Wed, 20 May 2026 18:19:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Thu, 21 May 2026 11:19:18 +1000 X-Gm-Features: AVHnY4J9J2FTNy5D1ThOZU1OToSmgcdwebAl_JJStdw_8qJmw9Yjzn63q6pVI6I Message-ID: Subject: Re: Proposal: Conflict log history table for Logical Replication To: vignesh C Cc: Dilip Kumar , Nisha Moond , Amit Kapila , shveta malik , Masahiko Sawada , Bharath Rupireddy , PostgreSQL Hackers , shveta malik Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Vignesh. I checked the latest v37-0001/0002 patches combined. My only comment is below. ====== 1. +/* + * drop_conflict_log_table + * Drop the conflict log table associated with a subscription. + * + * The conflict log table is registered as an internal dependency of the + * subscription. This function removes the dependency by performing a + * cascading deletion on the subscription object, which in turn drops the + * associated conflict log table. + * + * This is used to clean up conflict log tables that are no longer required, + * preventing accumulation of stale or orphaned relations. + * + * NOTE: + * Only conflict log tables are currently managed via this internal dependency + * mechanism. If additional internal dependencies are introduced in future, + * this function may require refinement to avoid unintended deletions. + */ +void +drop_conflict_log_table(Oid subid, char *subname, Oid subconflictlogrelid) +{ + ObjectAddress object; + char *conflictrelname; + + conflictrelname = get_rel_name(subconflictlogrelid); + + ObjectAddressSet(object, SubscriptionRelationId, subid); + performDeletion(&object, DROP_CASCADE, + PERFORM_DELETION_INTERNAL | + PERFORM_DELETION_SKIP_ORIGINAL); + + ereport(NOTICE, + errmsg("dropped conflict log table \"%s\" for subscription \"%s\"", + get_qualified_objname(PG_CONFLICT_NAMESPACE, conflictrelname), + subname)); +} + IIUC, this is a function that drops the subscription dependencies via cascade. Since the CLT happens to be the only such dependency, it gets dropped. The current implementation feels backwards to me. IMO, this is really a subscription function, so it should be refactored to be called something like 'drop_subscription_dependencies', and not be in the conflicts.c file. Refactoring/renaming to what it *really* does means you won't need to give the other warnings like "may require refinement to avoid unintended deletions". Maybe the callers do not need to be guarded anymore -- this code can check internally so that it only does anything when there is a known CLT associated with the subscription. Also, the function comment should make it clearer that PERFORM_DELETION_SKIP_ORIGINAL means the parent subscription object is not deleted. ====== Kind Regards, Peter Smith. Fujitsu Australia