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 1wgc7C-006I4j-1y for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 05:43:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgc7B-00F60p-1U for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 05:43:33 +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 1wgc7B-00F60f-0X for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 05:43:33 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wgc79-00000001lAp-0juW for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 05:43:32 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-4758b2a9e2aso1532856f8f.2 for ; Sun, 05 Jul 2026 22:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783316610; x=1783921410; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=69pxSsbpYA5Zgca/1wXlv8/sbNRqftIMiJL53XfkL9g=; b=gqp7xjUTwSdmMQ7Rwc1hNinBmcBIP9aZg5IxY3CQBb3RFl63CUVBS7wyg0/SW9LxN5 Sux9fauKwE9KkAbdLeZCJfE0I+3Ui/F3b5jZulQwu71m+8Ep+KukM6UJ+r8XPBPj4IXP RamLOmB6J/05ICuugxJ89XsD6rgbLz/HwYbkv3u++kSYVWWPBfaedlJbStYzenNy5rmU XpNDIobwClY4kjYvrZbJ5RG3fVrXXV97y0jxd4Cm0Hpn3snabTCsl0dL6AjufoqORurL FWAjdG3GwCEVkBwAurxp9sI+RxwXPsd71BVtWF/rt9brQfSEIQ3QAXQ6yMaMzJyCpyuJ mm2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783316610; x=1783921410; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=69pxSsbpYA5Zgca/1wXlv8/sbNRqftIMiJL53XfkL9g=; b=P8wSCq7Q6o1RX9q+IWBetfr8AGMAJyW0m+h1Kl8Z+M+GfaamfdSekDr5wV6rD3nRXl zokEfYkZcxIGi5do45xQVDOt2klJZk/x909XeyUGpyMMFYg4HEVa0/68lzE+VuyP91I6 NN3ZOGAssG6FhrEtYSWf+U7Wx1xiGk28sSpbJ3ktomNt95e3oZBkZtbPBMyM+1m2bTla I9/a5hMu6TJ/SiWUGAff/riXpgy+YafKOJp+iwT7mjqRK930md66k3Fm5LSHRA9I29ap bS4i/q+8Ux7eAWOynGqCbsiCovgWAgisVJJUvAOjXcktcqHUTrf8cbEsJK12EugY/xPO oDCA== X-Forwarded-Encrypted: i=1; AHgh+RoEhY1UfWRwz7Onf2fe1pDWChf26ruzyZvgstPMeNXZVVyepXT+hkxyVMCztN+J3ijxPdUgOh252FwTicn3@lists.postgresql.org X-Gm-Message-State: AOJu0YxWc/nzZoGSmEBA5aX1CXNzgFpKYkS8+bh/sVoXKsY8tWiKss+W D/JQqaa3wZpD+iwTctU1Dde6+anPYPVoYL65NVefuQAsC0ydgDaGIOK2 X-Gm-Gg: AfdE7ck2lAw55Djn2W2EbM6HnLrvXIdVk4/ukCx/LvpmlHWYP1DMePmhxu3UupKs6Hl rfEJCxQNQODgJDRelcVSW027tWNof+lBy+tTOZ2BLzxaWpAeKZ8wtViXDxj4rap6qKY47xrbTyo opSRthLnc0REmozgm6uSBhr50gNOsDyCDf84MxrAG5SYPPGjM4rYrqjLflUFXLmr7tGC6zsxH1h 5YA2vBBmH42iPaA3YJMf/kSbAovfl/OzhscxCRHLQmz3dtK4nunXsTMf38ozoHUOwWkzeWbKoAK //pdCc8tPtIcK03zLAt45Nf8dyL5E9iEs6/Gw/cNkq1oCjTHKf8F/OEmdlZdNpC2UmnfbPPwfbQ ClPyLk1+ON7SfUEV+ebALTWfRA7FyBUfUTq8GjXA905OlW3qiFt7rM2vR38eNBulDubdNZKDiB/ vQrCta0Nw+Y1Zl+mZs1GWZrKRkLtrhMSkHGE8yvbSCAyvrpxmcNk5GbiOEodFYAtAkk14w4Ca8N 1DJW68mScs= X-Received: by 2002:adf:e391:0:b0:475:f0c2:5b07 with SMTP id ffacd0b85a97d-47aad8304d0mr7656276f8f.61.1783316609735; Sun, 05 Jul 2026 22:43:29 -0700 (PDT) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47aa039ae44sm21117327f8f.23.2026.07.05.22.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2026 22:43:29 -0700 (PDT) Date: Mon, 6 Jul 2026 05:43:28 +0000 From: Bertrand Drouvot To: Amit Kapila Cc: "Zhijie Hou (Fujitsu)" , Dilip Kumar , "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@lists.postgresql.org" Subject: Re: Re-read subscription state after lock in AlterSubscription Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Jul 06, 2026 at 10:24:26AM +0530, Amit Kapila wrote: > On Fri, Jul 3, 2026 at 9:09 PM Bertrand Drouvot > wrote: > > > > On Fri, Jul 03, 2026 at 03:45:34PM +0530, Amit Kapila wrote: > > > > But while doing this and looking closely, I'm not sure AlterPublication() does > > it right. Indeed, in theory, the OID could have been re-used too (between the > > time we did the name resolution and the time we lock the publication). I think > > what is needed is something similar to RangeVarGetRelidExtended(), means do the > > name resolution, acl check (ownership) and lock acquisition, all in unison. > > > > It seems RangeVarGetRelidExtended() also doesn't do the additional > invalidation handling if the caller already has an appropriate lock, > see comments [1]. From what I can see, the NoLock callers of RangeVarGetRelidExtended(), are for callers that don't modify objects (they are "read only" callers). The only exception is nextval() but there is an XXX that mentions it. Here we modify the subscription or publication, so I don't think we are in the NoLock spirit of RangeVarGetRelidExtended(). > Apart from that also, I am not sure it is a good > ideal to add this additional handling in Pub/Sub DDLs as in worst case > scenario even if the OID is re-used the user will face "tuple > concurrently updated" or similar ERRORs, it won't do anything wrong. That's probably right before a5918fddf10, but with conflict_log_destination='table' we now perform creating/dropping a table based on the stale data before it ever reaches CatalogTupleUpdate(). Also, even prior a5918fddf10 I believe there might be situations that could not produce the tuple concurrently updated" but corrupt the tuple (say if vacuum had the time to clean up the tuple and the same ctid is reused). Probably extremely rare scenario, though. > So for such rare cases, it doesn't seem worth adding this additional > re-checking machinery. Based on the same theory, I am thinking again > whether it is worth backpatching these patches? I mean these fall into > the category of improving user facing messages during Pub/Sub DDLs, so > isn't it okay to just push this work in HEAD? Those are not ereport() but elog() messages so not "expected" to happen. Based on the above, I'm thinking that backpatching 0001 and 0002 and keep 0003 and 0004 only for HEAD could make sense. What do you think? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com