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 1wokOI-001Eaf-0z for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jul 2026 16:10:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wokOF-001nan-0l for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jul 2026 16:10:47 +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 1wokOE-001naf-2d for pgsql-hackers@lists.postgresql.org; Tue, 28 Jul 2026 16:10:46 +0000 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wokOB-00000000lZo-49Oq for pgsql-hackers@postgresql.org; Tue, 28 Jul 2026 16:10:45 +0000 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-7ee4399c3abso30008a34.2 for ; Tue, 28 Jul 2026 09:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20251104.gappssmtp.com; s=20251104; t=1785255042; x=1785859842; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=BnW7ZqXZtUjph0dIC+N9lbk6KkMEwPBM4S0sR8O0v/o=; b=w6D66X0SxrjCIK0+kOpt7uCQ9NSE8oevC+rM8fVyHQ0TSVTWeb3z75v72sfZGByFEx B1j2LnmhClQoW8iDE+mSVwWsz7yrwBVGzwNrFXecllN2kc2KZRFRJnXn7qLmnQa+yHMC wIWURJvgD6eF3zxq7QuKs92D+Xg7mKMJ6ONxLPKgWkxA7cgUrphgEihXMC33QxGjTvmR lpj83U0k/LzcbwBk/LCthXjmzs9JIdnAz/YOkV2c1eMfsnBsRY0TWojAyzq3l6TzE2BF UuglGHvdAzKqDUZ7amqv0LU+yisZVvWLH9vM6uwlQPdmnrNKMpF/URW6kVIptPUnp7Vt /ptg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785255042; x=1785859842; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=BnW7ZqXZtUjph0dIC+N9lbk6KkMEwPBM4S0sR8O0v/o=; b=LSKw9o2mN0QQnUK537afI1kBdzFeaESpRDWYDYgjdUMIeW/X1Zdf1JOzWeeTCnh6qA wML+LFLkZ+Fb9W0icqCnqFoHVeWinfLwOC/SaPjrSgQgbxoWoJ6WvABXI4cYMPU421Rr EJOilJCFqEVJy3ChFeCnpU5IVFbcgHQQSwec7lUUnpfZpR7gF256VlzaZ7Au5klDE6Vd k5Ub+pdAds3FN0TlNfP5413KDg8L0n3cD6I2f+UcGZzzAq/N2u5XwKZMoWnRjDmxSfDS w3252J2t58BDyQzCR6U+KJAITHOaVBrX4gIWKbrdj2mJvecvzWT1py51hYVoikAyAzfx sj5A== X-Gm-Message-State: AOJu0YzjGwjm+9FDg0LAooKApYTQlsYQOJqkwxArKFWn6vSgnIQ73kee XVHLxDnrT4kFk/a7/k25/jWWW5Xw35+PBUcJcJxS1a/JOoBCTH4TyTSG+8C6hIr+S8KvN1hzZk+ vkPE= X-Gm-Gg: AR+sD13M2AqMfg5N+jb9dPy6jrHKFwBEUgeX+1MaFjZXm03pEhl0zd24HTto6Iks45R qeD9eeCA2TT8ocGRDwKFHgNAmJHTX2bLgSrT45zeps+q9jN/3gyZwRpjMslVeMNfPtzSIW9Mwk1 ls+gUWUYrhG89f6GTjQW0oM9Qd+RAaYwygBEXzJttK3Dl+ulUXb3s38HostFmfv4IE8cS1LA2xL KI7fqkXFiDwA6Vuym23dS/k6CsW3kIsErTGUQofizzh1bamZSpXq33LfLPw07WBxBzGcGjyY84z Jd3gplNlhDihJ0+rxs/1Q+pK+mjXlX91DFPogw/AeCrIRosGOtXYioSmLB4HvByCiZTIifjzYO+ 3tFDvV1nqmL85wPni98zMBY3APrMYVO0rwcTUq0paYseSNcL3Z/cLi2iGbw8iBMM+0ZWgnIl0ve sHiPunHG9fOxpp X-Received: by 2002:a05:6830:6407:b0:7dc:3db6:f02 with SMTP id 46e09a7af769-7effef3fdccmr1866850a34.9.1785255042102; Tue, 28 Jul 2026 09:10:42 -0700 (PDT) Received: from [10.10.245.176] ([50.175.226.11]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7f00d8d397asm76877a34.17.2026.07.28.09.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 09:10:41 -0700 (PDT) Message-ID: Subject: Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc. From: Jeff Davis To: Noah Misch Cc: pgsql-hackers@postgresql.org, Amit Kapila Date: Tue, 28 Jul 2026 09:10:39 -0700 In-Reply-To: <35e50b0f80c850e5b9eb1dedcc0844852a2d2de0.camel@j-davis.com> References: <20260710195902.4f.noahmisch@microsoft.com> <35e50b0f80c850e5b9eb1dedcc0844852a2d2de0.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1.1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 2026-07-19 at 15:32 -0700, Jeff Davis wrote: > Generating and validating the connection requires the subscription > owner to be set correctly, the foreign server ACLs to be set, and the > user mapping to exist. The checks at DDL time are were a convenient > way > to catch errors, but end up being too strict because those things can > change before the connection is actually needed. In particular, > pg_dump > does the DDL in parts (first creating the subscription, then changing > the owner), and we need the first part to succeed. There are two other threads discussing closely-related problems: https://www.postgresql.org/message-id/CAHGQGwFGa6+wWVgUmZPFwN=3DfBY59mYPkMK= 3=3DTxT=3DPv5C1mNNRQ@mail.gmail.com https://www.postgresql.org/message-id/OS9PR01MB12149C3ED34272966B25DB173F5C= 12@OS9PR01MB12149.jpnprd01.prod.outlook.com I'd like to step back and discuss where the complexity comes from: * During restore, we simply want it to recreate the right catalog state, and it uses multiple commands to do so (CREATE SUBSCRIPTION, ALTER SUBSCRIPTION OWNER TO, etc.). It should never connect to the publisher, and validation is mostly counterproductive for the intermediate states. * When we no longer need a slot (due to ALTER/DROP), we would like to drop it from the publisher, but for various reasons a connection to the publisher may be impossible. In that case, the user may still want the ALTER/DROP to succeed. * Validation at DDL-time is useful for interactive purposes, but limited. Whatever is validated may change before connection time (e.g. privileges on the server may be revoked), so connection-time validation is the authoritative one. To reconcile these goals, we need to weaken DDL-time validation a bit, be more precise about when we try to generate a conninfo, and then be sure that restore doesn't do anything that would cause a conninfo to be generated or a connection to happen. We can preserve the most useful kinds of validation by putting it behind an if (!superuser()) guard, so it doesn't interfere with restores. Thoughts? Regards, Jeff Davis