Re: postgres_fdw: Useless if-test in GetConnection() - Mailing list pgsql-hackers

From Richard Guo
Subject Re: postgres_fdw: Useless if-test in GetConnection()
Date
Msg-id CAMbWs4-G59FBY7gA06c+wW7j+3=WBS5J6s1vXJsjfBsEJsCeJA@mail.gmail.com
Whole thread Raw
In response to postgres_fdw: Useless if-test in GetConnection()  (Etsuro Fujita <etsuro.fujita@gmail.com>)
Responses Re: postgres_fdw: Useless if-test in GetConnection()  (Etsuro Fujita <etsuro.fujita@gmail.com>)
List pgsql-hackers

On Wed, Mar 15, 2023 at 6:18 PM Etsuro Fujita <etsuro.fujita@gmail.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.  I think we could instead add an
assertion, but I did not, because we already have it in
make_new_connection().

+1. Good catch.

Thanks
Richard

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: TAP output format in pg_regress
Next
From: Ants Aasma
Date:
Subject: Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode