Re: postgres_fdw: Useless if-test in GetConnection()

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: postgres_fdw: Useless if-test in GetConnection()
Date: 2023-03-16 09:28:41
Message-ID: CAPmGK15TZ9KsqBemCkCVdKZq8x0Uzi4ARUYiV8UCHYKOKznjDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 15, 2023 at 7:58 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> > On 15 Mar 2023, at 11:18, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
> > While working on something else, I noticed that the “if (entry->conn
> > == NULL)” test after doing disconnect_pg_server() when re-establishing
> > 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 already
> > have it in make_new_connection().
>
> Agreed, the assertion in make_new_connection is enough (and is needed there).

Great! Thanks for looking!

Best regards,
Etsuro Fujita

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-03-16 10:00:37 Re: suppressing useless wakeups in logical/worker.c
Previous Message Drouvot, Bertrand 2023-03-16 09:25:59 Re: Get rid of PgStat_BackendFunctionEntry