pgsql: postgres_fdw: Fix tests for CLOBBER_CACHE_ALWAYS. - Mailing list pgsql-committers

From Fujii Masao
Subject pgsql: postgres_fdw: Fix tests for CLOBBER_CACHE_ALWAYS.
Date
Msg-id E1l5epG-0001zJ-2E@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
postgres_fdw: Fix tests for  CLOBBER_CACHE_ALWAYS.

The regression tests added in commits 708d165ddb and 411ae64997 caused
buildfarm failures when  CLOBBER_CACHE_ALWAYS was enabled.
This commit stabilizes those tests.

The foreign server connections established by postgres_fdw behaves
differently depending on whether CLOBBER_CACHE_ALWAYS is enabled or not.
If it's not enabled, those connections are cached. On the other hand,
if it's enabled, when the connections are established outside transaction
block, they are not cached (i.e., they are immediately closed at the end of
query that established them). So the subsequent postgres_fdw_get_connections()
cannot list those connections and postgres_fdw_disconnect() cannot close them
(because they are already closed).

When the connections are established inside transaction block, they are
cached whether CLOBBER_CACHE_ALWAYS was enabled or not. But if it's enabled,
they are immediately marked as invalid, otherwise not. This causes the
subsequent postgres_fdw_get_connections() to return different result in
"valid" column depending on whether CLOBBER_CACHE_ALWAYS was enabled or not.

This commit prevents the above differences of behavior from
affecting the regression tests.

Per buildfarm failure on trilobite.

Original patch by Bharath Rupireddy. I (Fujii Masao) extracted
the regression test fix from that and revised it a bit.

Reported-by: Tom Lane
Author: Bharath Rupireddy
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/2688508.1611865371@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f77717b2985aa529a185e6988de26b885ca10ddb

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 223 ++++++++++---------------
contrib/postgres_fdw/sql/postgres_fdw.sql      |  97 ++++-------
2 files changed, 121 insertions(+), 199 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Doc: improve cross-references for SET/SHOW.
Next
From: Noah Misch
Date:
Subject: pgsql: Fix error with CREATE PUBLICATION, wal_level=minimal, and new ta