Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcjst-0006aZ-Nv for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 09:26:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pcjss-00089t-K1 for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 09:26:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcjss-00089W-AY for pgsql-hackers@lists.postgresql.org; Thu, 16 Mar 2023 09:26:54 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pcjsq-0007vf-4s for pgsql-hackers@lists.postgresql.org; Thu, 16 Mar 2023 09:26:53 +0000 Received: by mail-wr1-x42b.google.com with SMTP id h17so855699wrt.8 for ; Thu, 16 Mar 2023 02:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678958811; 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=ilXjesxujyxxHqO0CO4nvDZeevwL0mQI3UEoX5wTQYI=; b=UEdLk7fPUvLqaN70MF00xoEwlKaEs3BcD7vCXS2UY3u5ovSTGM+Xrhtc6R951MG0bv jI6E/eoPum3q/MiCwXq91ZSn3Op2QxkJUS5To4OqnxhCx+phvBS608mpLGP+ys7DCYda IjfwArEKZ046aav9jcxeQqp6LHLzprw9rSmFYWUt02jtpK8sFV4BEPcXfRz1NAhQIHy0 eqg27pkCpfKNfMNW25jBgMIe79XytpItFSiM8G242KOQdGLrWFelEAUw3/33yLoFu5Cp H9Z8vL29BVuJjnoJnHbw5ZAxe/WT+bwa9G/xRrdD1ix4NfFtTDaZl3m4F4gp3gvCqKLC Hw0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678958811; 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=ilXjesxujyxxHqO0CO4nvDZeevwL0mQI3UEoX5wTQYI=; b=EEWNQIBWl7YPOyjd6BT/EM2zzUz5VqqzCajjvzZEW7PEvgNl6eCUm+PiwvXdXkbrzc PT5dt7xeAuW+L9NZx4OD/5ktvruLiX9UBBedxqR8EBi6dFIpJfH1VcHnQQcbJSY4jPdd 3mh9yILJZNVmaIjWVe+ZadeOyTmixSVZ95oH/szLzj7miCfDVkM2M84lsrSMLaQOtXnN Sh5GPZLxCgMI+sRlE6rWqIksrFg6F3rx0gQuHv3VLsRvp8qgfXppWqq0WRWTIvvO2mh+ TPUBDzleHwpBcWCG1JSrWF/xGoJdRjXO7B5HkN8JyYvh2d/znEnerPEyPQAtmLEuDOJR pEzg== X-Gm-Message-State: AO0yUKXSxLxFMWPk1lHo4uBviSnXD9VUYlpCDWcrr9zcBK4mIuhjRhvF Ogf/nx7DmholG5pMScbZM5VSByhbINaTIOFrAS4+KQLLRY0= X-Google-Smtp-Source: AK7set8aajUYATHolHplN4fEtNti7ghFabSO7mouebZEfPNOtsrMIEB0+rFpr0EPa5/3t/YuUI3NfxxMPKDRQ6tgzVc= X-Received: by 2002:a5d:49d0:0:b0:2cf:ec67:8f9f with SMTP id t16-20020a5d49d0000000b002cfec678f9fmr946434wrs.13.1678958810704; Thu, 16 Mar 2023 02:26:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Etsuro Fujita Date: Thu, 16 Mar 2023 18:28:41 +0900 Message-ID: Subject: Re: postgres_fdw: Useless if-test in GetConnection() To: Daniel Gustafsson Cc: PostgreSQL Hackers 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, Mar 15, 2023 at 7:58=E2=80=AFPM Daniel Gustafsson = wrote: > > On 15 Mar 2023, at 11:18, Etsuro Fujita wrote= : > > While working on something else, I noticed that the =E2=80=9Cif (entry-= >conn > > =3D=3D NULL)=E2=80=9D test after doing disconnect_pg_server() when re-e= stablishing > > a given connection in GetConnection() is pointless, because the former > > function ensures that entry->conn is NULL. So I removed the if-test. > > Attached is a patch for that. > > LGTM, nice catch. > > > I think we could instead add an assertion, but I did not, because we al= ready > > have it in make_new_connection(). > > Agreed, the assertion in make_new_connection is enough (and is needed the= re). Great! Thanks for looking! Best regards, Etsuro Fujita