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 1rLhea-009c0F-Hp for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jan 2024 10:42:16 +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 1rLheZ-002PuX-0e for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jan 2024 10:42:15 +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 1rLheY-002PuP-Mz for pgsql-hackers@lists.postgresql.org; Fri, 05 Jan 2024 10:42:14 +0000 Received: from mail-ua1-x92c.google.com ([2607:f8b0:4864:20::92c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rLheV-00Drvh-Vx for pgsql-hackers@postgresql.org; Fri, 05 Jan 2024 10:42:13 +0000 Received: by mail-ua1-x92c.google.com with SMTP id a1e0cc1a2514c-7cc6c88fb12so254814241.0 for ; Fri, 05 Jan 2024 02:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704451331; x=1705056131; 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=SBjxjHYV2bGVi8HUOSvOhq26um+qsns+tw7AeiGmI5U=; b=goXDlA4DDQ1x3uEvGvpa0Am3r00xv8rQD115WxPde2SNtRGxzQcan0N9CWrWV1SNyv +h6/BEax/M7US1CDCnU/M+k7FZpEqq89CQbtqsObi/PQW17tlLzN45GbCEtPWSOR9qok gJbq2XMB79Ayrsc9vXs+i+w5GLryPn29OMzVCDJ+Cfs0f1LoCcE+rha0AGdc531+trl7 X4mWX2FOCnqF+XwgGeBj/xlayu8Uvj5w4QbLTsmBeJEm84wYv2BA6zzNfzSDeNW1mFoK x80fvyvbZ9NXxyW7/OI8oIzTPYQkT/Fu3WDW2+vobwgHjEU/3qpWfyRQulHVa7LMLMUW dCDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704451331; x=1705056131; 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=SBjxjHYV2bGVi8HUOSvOhq26um+qsns+tw7AeiGmI5U=; b=wHgkvVL4HnorE7xq3DHMO1okZUB4Me0fWxhz+8DTBnvq2PukXvpQnELhR9Roibxghr WqSxkYlgp44ME+gq+H+igVnEiXsuPeceNDM/GGfOo9UW9rdrVYEkp6SUPSV8UXioPSVW bVUTCjnXoLLxntxlggZa2YQFevempUaCA/h8C5b6Tog/uDWfy+VFnG8PaE4HoRt3/vJG h4ugGKFCO/PTv9t1jZ7EWloy3gUK9Qifb5wjmJOX2bVGUJhDXbxpkXXHVM2XEeTMy+gQ VKWYiiZbBow9bgxS+ryE5XoXOHDX/6tSUOcbdH5yyHXcQWH8Elq/Dm3T7oDmvw1NCzUY z51A== X-Gm-Message-State: AOJu0YxQ0lEDGW3VfWuaJWgTG1oC18xncgn5iypvTg1+IqSpSqTSQiD9 4kgDVxl7edNeyAfp4xsTUJz17ykmzURxiOLeBlU= X-Google-Smtp-Source: AGHT+IFiCDu6/0cT5PbYbkcR52ZgJwTUt8Ei5mTiKKsdzCGeS7G9LgvOpMir1ZWrk1zL75WvjNUaj67z0zpCapy2WAw= X-Received: by 2002:a67:ea58:0:b0:467:b8fc:18bc with SMTP id r24-20020a67ea58000000b00467b8fc18bcmr108357vso.21.1704451330848; Fri, 05 Jan 2024 02:42:10 -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> In-Reply-To: From: Ashutosh Bapat Date: Fri, 5 Jan 2024 16:11:59 +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 Fri, Jan 5, 2024 at 1:34=E2=80=AFPM Jeff Davis wrote= : > > On Fri, 2024-01-05 at 12:49 +0530, Ashutosh Bapat wrote: > > Can you please provide an example using postgres_fdw to create a > > subscription using this patch. I think we should document it in > > postgres_fdw and add a test for the same. > > There's a basic test for postgres_fdw in patch 0003, just testing the > syntax and validation. > > A manual end-to-end test is pretty straightforward: > > -- on publisher > create table foo(i int primary key); > create publication pub1 for table foo; > insert into foo values(42); > > -- on subscriber > create extension postgres_fdw; > create table foo(i int primary key); > create server server1 > foreign data wrapper postgres_fdw > options (host '/tmp', port '5432', dbname 'postgres'); > create user mapping for u1 server server1 > options (user 'u1'); > select pg_conninfo_from_server('server1','u1',true); > create subscription sub1 server server1 publication pub1; > > I don't think we need to add an end-to-end test for each FDW, because > it's just using the assembled connection string. To see if it's > assembling the connection string properly, we can unit test with > pg_conninfo_from_server(). Thanks for the steps. I don't think we need to add a test for every FDW. E.g. adding a test in file_fdw would be pointless. But postgres_fdw is special. The test could further create a foreign table ftab_foo on subscriber referencing foo on publisher and then compare the data from foo and ftab_foo to make sure that the replication is happening. This will serve as a good starting point for replicated tables setup in a sharded cluster. --=20 Best Wishes, Ashutosh Bapat