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.94.2) (envelope-from ) id 1rV3Ni-00EZ6h-B8 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Jan 2024 05:43:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rV3Nh-00Be9T-2l for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Jan 2024 05:43:29 +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.94.2) (envelope-from ) id 1rV3Ka-00BaAT-77 for pgsql-hackers@lists.postgresql.org; Wed, 31 Jan 2024 05:40:16 +0000 Received: from mail-ua1-x933.google.com ([2607:f8b0:4864:20::933]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rV3KX-004H0k-Nx for pgsql-hackers@postgresql.org; Wed, 31 Jan 2024 05:40:14 +0000 Received: by mail-ua1-x933.google.com with SMTP id a1e0cc1a2514c-7cedcea89a0so2365301241.1 for ; Tue, 30 Jan 2024 21:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706679613; x=1707284413; darn=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=wzwXXiKBwpfS8NCM3DQojFVjfSenPhybVe56d/H/+34=; b=Y+gUaAluBnoWpgQwZ2TBEYbM9u/Zb8HNQOoG1JvM0hK4nYGhbCof6O94az8iibx2tC 1ovkqNwnCrxYJZSwyLKZHn2USK8wGW7WTm4zSR7fzIvSO/dMavBoxRVD3PvZEbjslRYt fwB+/pQXj/ORXEH6VcTgGQFJSL56dQRee4yZ5QPenTk9nlSnjMPxULkc76mVbh+Fhhh1 zQ/7hvYhqF1x/XZtB94U657rZ1mr/qgYwhbCdo5+0lY3XbB01n5FrfYylgTFnPdml44K mCHkuR/xMki/NDi0Dfec4Bd8O9VxKBGFPgYcin+TXaOau11bH5A8/mz94sRLvlW6hNZk oonA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706679613; x=1707284413; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wzwXXiKBwpfS8NCM3DQojFVjfSenPhybVe56d/H/+34=; b=cevJbtNYCBm5w9WTwVoaddmmdf6zUHTqKxhXH2xiROC7W1DSEhMOE8yD3/H84kuAai Y2busiiZWezJWiKQcZ23ZdVb5EagtwR2+wct252w+e2I0tmIus2jizqjjQU7tzVHCN8S Z3PzvZcFE3jBpaa3kVjB3dsSZJewocPXz8qRKtJ+52EKIio6Vg4LN5uSRxwgntk+VIKE vJNKtZkq8/dtXKBMHJuwyOYHHrWoXIRu0qpJh2cEFuY6mCvzVjJbIqmsjOYEcNlkOv8X 9eQNay4KcF6a0qXijgBsNcifV4vlgLCm5kyfs0HUvIIMyxtiEwOx6nNjK0ACm1Ult1Nl EXDg== X-Gm-Message-State: AOJu0YxgjC00jfFiM1r0IWRucfosDJsDcpQdGWipXL0pmfY90H7m2Xp2 ZPLlO833VkpJ+hTmgv7tM+2E5KlYEzETHYtAsuKp9WE9BdhMBx7bEco8k8qLGcCO6H2Ol9q+dyi hSDP2s7XlUyqZ1RedLwnlt35rGM8= X-Google-Smtp-Source: AGHT+IGkjD/NnEIPDMY1+oJEPEE+q9HwCnuAOco6oU18dbeQB4SlXeKoRG7Iw/zlpinMfX2aHFG2LXkr2QBJHMlPfjY= X-Received: by 2002:a67:f345:0:b0:46b:3a27:98a5 with SMTP id p5-20020a67f345000000b0046b3a2798a5mr566419vsm.41.1706679612852; Tue, 30 Jan 2024 21:40:12 -0800 (PST) MIME-Version: 1.0 References: <149ff9264db27cdf724b65709fbbaee4bf316835.camel@j-davis.com> <830a2bc6cbbb2e6e01c6c0d9f31f320822e10603.camel@j-davis.com> <433d0845248e86c0317d9d396926182cfe157340.camel@j-davis.com> <05ae37abb207cd6bf6b126780024692d91402b0b.camel@j-davis.com> <93392ffa941ab0d436e19e0ab5d04d0e42c02d3f.camel@j-davis.com> <26be917cb07b6aa3ef5dd15f6b59d1b375ece6e8.camel@j-davis.com> <55201bd916e748acfc754c8f95880dae8e4e5ed0.camel@j-davis.com> <2a89b14a2b1622bffb8b137ca1f9ab7866f2d2b9.camel@j-davis.com> <61831790a0a937038f78ce09f8dd4cef7de7456a.camel@j-davis.com> <0910b47040406c1d24ec0150dafb5bae6b910ed7.camel@j-davis.com> <7338f22c4534322a08ab6ce9f879e2e308eb5e5d.camel@j-davis.com> In-Reply-To: From: Ashutosh Bapat Date: Wed, 31 Jan 2024 11:10:00 +0530 Message-ID: Subject: Re: [17] CREATE SUBSCRIPTION ... SERVER To: Jeff Davis Cc: Bharath Rupireddy , Joe Conway , pgsql-hackers@postgresql.org 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 Wed, Jan 31, 2024 at 2:16=E2=80=AFAM Jeff Davis wrot= e: > > On Tue, 2024-01-30 at 16:17 +0530, Ashutosh Bapat wrote: > > Converting a server and user mapping to > > conninfo should be delegated to the FDW being used since that FDW > > knows best how to use those options. > > If I understand you correctly, you mean that there would be a new > optional function associated with an FDW (in addition to the HANDLER > and VALIDATOR) like "CONNECTION", which would be able to return the > conninfo from a server using that FDW. Is that right? I am not sure whether it fits {HANDLER,VALIDATOR} set or should be part of FdwRoutine or a new set of hooks similar to FdwRoutine. But something like that. Since the hooks for query planning and execution have different characteristics from the ones used for replication, it might make sense to create a new set of hooks similar to FdwRoutine, say FdwReplicationRoutines and rename FdwRoutines to FdwQueryRoutines. This way, we know whether an FDW can handle subscription connections or not. A SERVER whose FDW does not support replication routines should not be used with a subscription. > > I like the idea -- it further decouples the logic from the core server. > I suspect it will make postgres_fdw the primary way (though not the > only possible way) to use this feature. There would be little need to > create a new builtin FDW to make this work. That's what I see as well. I am glad that we are on the same page. > > To get the subscription invalidation right, we'd need to make the > (reasonable) assumption that the connection information is based only > on the FDW, server, and user mapping. A FDW wouldn't be able to use, > for example, some kind of configuration table or GUC to control how the > connection string gets created. That's easy enough to solve with > documentation. > I think that's true for postgres_fdw as well right? But I think it's more important for a subscription since it's expected to live very long almost as long as the server itself does. So I agree. But that's FDW's responsibility. --=20 Best Wishes, Ashutosh Bapat