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 1rPaWC-00ChBL-4N for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jan 2024 03:53:40 +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 1rPaW9-001Ihd-Ee for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jan 2024 03:53:37 +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 1rPaW9-001IhU-57 for pgsql-hackers@lists.postgresql.org; Tue, 16 Jan 2024 03:53:37 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rPaVz-001kei-V1 for pgsql-hackers@postgresql.org; Tue, 16 Jan 2024 03:53:33 +0000 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2cda523725bso25856611fa.3 for ; Mon, 15 Jan 2024 19:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705377206; x=1705982006; 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=B3ZG6ADzwAw5owpTovOQ55C1SG1MMTk/6fJL43G4Lk0=; b=Dydg71KV/ibAiMQ98RK1gQ7jkLzd9e/NB3JrugdeUH48YWNa3bj6zrkgXQqM+cwtZV tCJUqum2yEAukjn1FHELWpv/dhmwmYXuUY6n/sKny22FShXl2l4sxdcKqi/4Lgu8pMbN x66EPwoWnsbgKDeKPdhmRK90FvrfAVqM77KW+f04wAtkIIgxsVKNzk3ulgJqez//RKPu kT6aRrPe4NbOcXOUGyvhQUzt9jR+C8f4VT38kFCSE/zBbOONauTebDB3Jd4yLqqasZTA eBk2TI1qUbpskYVK/ginGQLMXb3Wvl9wtbtTtnCSFFYvTeMYsLzDG3nRukIO1clEMRas 3dmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705377206; x=1705982006; 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=B3ZG6ADzwAw5owpTovOQ55C1SG1MMTk/6fJL43G4Lk0=; b=aLDE8jPVPSKXDa2e4tjH7irXjkqMsmVL+7DN1NielQ6uIcCLWt5VAWyq0HHp5ueeoU 4jokMf4YiMz3a9Q6tDu//CmjCa9IMDhHPAkbBuYGzVleeF960I+aBZ9kriRDsD3MVCed a0U7LSerY8WgSj0L4+c+Vc+bocx3cS91q2Kg6yTOvfdMkX7yerGRgSMs3viMxpHqZQ5k rp9XCLX4yXX/bwmc387Wy3VFVcKE286th/qGpC1SvS4vHog1DFwXjGewqGnBcO+5huFF ae35xgCuy3G7GyAuO9G2fsjDah7MDH9av6Wq9lRrkfv7l80bycBW+CWBgO9NKnVxjTHp GhTA== X-Gm-Message-State: AOJu0YwkVXQuLBpDS2z3pxQW7aiq9vV+oU0gG0tjT5ZSemYzgmI9fm79 Pk6UyJbsYlCZQH7Afk+LZB/aa6NnMqM3sv5V8Y4= X-Google-Smtp-Source: AGHT+IE519fLCRa3TfYnGPWGBtNxfyxNCBv6Kd//cnJYYGvyTtEmt1MOjQdbsM+BkDOuN54p8zYsM9/r0DBAveUakVA= X-Received: by 2002:a05:651c:c89:b0:2cd:ccc1:70f2 with SMTP id bz9-20020a05651c0c8900b002cdccc170f2mr1073260ljb.27.1705377205782; Mon, 15 Jan 2024 19:53:25 -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> In-Reply-To: <61831790a0a937038f78ce09f8dd4cef7de7456a.camel@j-davis.com> From: Bharath Rupireddy Date: Tue, 16 Jan 2024 09:23:13 +0530 Message-ID: Subject: Re: [17] CREATE SUBSCRIPTION ... SERVER To: Jeff Davis Cc: Ashutosh Bapat , 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 Tue, Jan 16, 2024 at 7:25=E2=80=AFAM Jeff Davis wrot= e: > > On Fri, 2024-01-12 at 17:17 -0800, Jeff Davis wrote: > > I think 0004 needs a bit more work, so I'm leaving it off for now, > > but > > I'll bring it back in the next patch set. > > Here's the next patch set. 0001 - 0003 are mostly the same with some > improved error messages and some code fixes. I am looking to start > committing 0001 - 0003 soon, as they have received some feedback > already and 0004 isn't required for the earlier patches to be useful. Thanks. Here are some comments on 0001. I'll look at other patches very soo= n. 1. + /* Load the library providing us libpq calls. */ + load_file("libpqwalreceiver", false); At first glance, it looks odd that libpqwalreceiver library is being linked to every backend that uses postgresql_fdw_validator. After a bit of grokking, this feels/is a better and easiest way to not link libpq to the main postgresql executable as specified at the beginning of libpqwalreceiver.c file comments. May be a more descriptive note is worth here instead of just saying "Load the library providing us libpq calls."? 2. Why not typedef keyword before the ConnectionOption structure? This way all the "struct ConnectionOption" can be remvoed, no? I know the previously there is no typedef, but we can add it now so that the code looks cleaner. typedef struct ConnectionOption { const char *optname; bool issecret; /* is option for a password? */ bool isdebug; /* is option a debug option? */ } ConnectionOption; FWIW, with the above change and removal of struct before every use of ConnectionOption, the code compiles cleanly for me. 3. +static const struct ConnectionOption * +libpqrcv_conninfo_options(void) Why is libpqrcv_conninfo_options returning the const ConnectionOption? Is it that we don't expect callers to modify the result? I think it's not needed given the fact that PQconndefaults doesn't constify the return value. 4. + /* skip options that must be overridden */ + if (strcmp(option, "client_encoding") =3D=3D 0) + return false; + Options that must be overriden or disallow specifiing "client_encoding" in the SERVER/USER MAPPING definition (just like the dblink)? /* Disallow "client_encoding" */ if (strcmp(opt->keyword, "client_encoding") =3D=3D 0) return false; 5. "By using the correct libpq options, it no longer needs to be deprecated, and can be used by the upcoming pg_connection_fdw." Use of postgresql_fdw_validator for pg_connection_fdw seems a bit odd to me. I don't mind pg_connection_fdw having its own validator pg_connection_fdw_validator even if it duplicates the code. To avoid code duplication we can move the guts to an internal function in foreign.c so that both postgresql_fdw_validator and pg_connection_fdw_validator can use it. This way the code is cleaner and we can just leave postgresql_fdw_validator as deprecated. --=20 Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com