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

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: postgres_fdw: Useless if-test in GetConnection()
Date: 2023-03-15 10:58:33
Message-ID: D7DDEE03-A38F-42E3-B946-7206B1D2B78A@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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).

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2023-03-15 11:18:25 Re: Fix fseek() detection of unseekable files on WIN32
Previous Message Ants Aasma 2023-03-15 10:48:22 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode