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 1wfvbP-005nIQ-2v for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jul 2026 08:19:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wfvbN-009xIi-30 for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jul 2026 08:19:53 +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 1wfvbN-009xIY-25 for pgsql-hackers@lists.postgresql.org; Sat, 04 Jul 2026 08:19:53 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wfvbL-00000001dSl-1YOf for pgsql-hackers@lists.postgresql.org; Sat, 04 Jul 2026 08:19:53 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-473dc4cf238so767746f8f.3 for ; Sat, 04 Jul 2026 01:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783153188; x=1783757988; 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=Ver1WizfgXMCT66Q6ff5/TYLLYWvkH/KAIGkBRCbf7U=; b=H+kcbi8dPLuMNLaqb0VvxPsCEpdy4rV7aBc+1VsUoqrUq05AvWzVqVVihjWEz7SRZG Zjh8fdrLnNV8wl19xV+2WJ2wUDlLIUV/4s+bSyzVGgZ06i355HGoElITT2eJhud9nFQ+ gpG1poLZF6oL8PaaNbWyqQ3OfiCb0dY+3CEF0/Zv+4XRTdUlxaGctDlNqyLDjz7EvVLi 0OnIZKqH+YD/ztSyNUFtYOBwYOGofHbTjMu65RX+O8iwznfh7yGKVfdFx8fa9bf1Dmyi i5G4WynIHfWZ9a5nM3CZ6OKzYaQGDMZ762zbypgVc2sv7JUSCWqjyFu0V4RlN1bibIWy c98A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783153188; x=1783757988; 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=Ver1WizfgXMCT66Q6ff5/TYLLYWvkH/KAIGkBRCbf7U=; b=ewsTIRVMmsr3RZuqUkQwt+X6JYS/vjmTvbH+Hgbc9QoGqf8Y4/hKZcXaUFsI6yZn7E p4iI99NAUuEJ4BTpKKXG67YyHfyqP6K+qSEnIMaLzZy867fxrnOQKptYRityvj4Na3Ku O8BRxIPUnr/aUhfqRQXlURvOqPTm09utm5v+b/iYF9Cw/uD1GQB/w9AIx9spbur/WxKh wrkD4IRsvzvwPlq0uYyfyillt1losjtpDdkTjTevemt/AK8WVH4pq8H/uL8lSxXxga4q KD5nQq/Bh6h9Ai6sZt5YuezWyHXMykydQzCEmPB8k2snkMjX77I3hR9uXMZfzOSGe2XA EjQQ== X-Forwarded-Encrypted: i=1; AHgh+Rr0n+UZa6E/1of26DqA3FqdovjNYpzKMLa/iMvCyAp85WzvHk1R31p0R5HUeaZ6uXIuGr+x7eYQr5AYPqCp@lists.postgresql.org X-Gm-Message-State: AOJu0YwzT8L8Ihdp3/X59XwyBFy8jae+K8t7zBag0hn+I8AsWnXniv2i ic5iTyVVVDHtIlVjTZBdsDC7ExzBVYfjRLm9f0GGE7J5AOv0HUMFjzfD X-Gm-Gg: AfdE7cnOMzdch56GAF68xlaFHVwCMG4NN7vOv/TAZHKAEHoCln16bv77c5l2BBqfrt9 EXZb+WEQo28qsnoW8DO1Jg9YScyKipRm6vMuHccDoKs/2wzgWREAneQ25ckAV1tN3GCtk7M5FKX 2WCpTOE7NNfS2max/m4pGI1BXV+oBvJmfeM6pu76L+rHFAC1/puN6M7yTO9+NTPhUxsJ4E711Uq MtdOLEQCSb00YFb/52KbCd7PLXpO1rq5l/Pb1gDGmr3kBeVtpxRcMpXPvBI8BtMu5nUscNj1aTT TwXIYVMI6kCAyXAu+VhYWqI7BeZGhaz9Likv2Nb1sogGdbV0pUhbIVHKXQT2tjd0FoVIG/BO8T6 aajEhUyI6fn3FvDTytlhz2GB7Js0MtcqawnFHno358Zrr/zFaQulIES7KzCvIIpwZ6R1XNiZt1M Fv1V238ZG2Qd3FokltA99gvMIZEN2tpHlWeXmu+iXm8/29wbSPE9hw8u7wGuz2fGLZCtZrAlSE X-Received: by 2002:a05:6000:4ca:b0:46d:d5da:f0aa with SMTP id ffacd0b85a97d-47aace8f160mr1963939f8f.45.1783153187924; Sat, 04 Jul 2026 01:19:47 -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-47a9de1d8cdsm6830566f8f.1.2026.07.04.01.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 01:19:47 -0700 (PDT) Date: Sat, 4 Jul 2026 08:19:46 +0000 From: Bertrand Drouvot To: Dilip Kumar Cc: Amit Kapila , "Zhijie Hou (Fujitsu)" , "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 Sat, Jul 04, 2026 at 01:30:08PM +0530, Dilip Kumar wrote: > On Fri, Jul 3, 2026 at 9:09 PM Bertrand Drouvot > 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. > > > > That's what 0003 is trying to achieve for the subscription and 0004 for the > > publication. > > > > What do you think? > > > 0003: > > It looks like the implementation of DROP SUBSCRIPTION IF EXISTS has a > concurrent drop race condition in DropSubscription(). Currently, if > stmt->missing_ok is true, the initial lookup safely handles a missing > subscription. However, once a subscription is found and the code > enters the drop loop, a second internal lookup/refetch happens. If a > concurrent transaction drops the subscription after our initial check > but before this internal refetch, the code throws an error. > Essentially, the loop completely ignores the missing_ok flag during > the refetch phase. Good catch, will fix, thanks! Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com