Fix flaky pg_dump test

Use DROP DATABASE WITH(FORCE) to drop the database in pg_dump test
since occasionally there would still be connections to the database
leading to test failures. Unfortunately PG12 does not support that
syntax so we have to drop without that option on PG12.
This commit is contained in:
Sven Klemm 2022-09-16 13:02:29 +02:00 committed by Sven Klemm
parent 1cb3edddc1
commit 85d0e16a98
2 changed files with 8 additions and 2 deletions

View File

@ -653,4 +653,6 @@ SELECT * FROM test_tz ORDER BY time;
(4 rows)
\c :TEST_DBNAME :ROLE_SUPERUSER
DROP DATABASE :TEST_DBNAME_EXTRA;
-- DROP DATABASE WITH(FORCE) is only available in PG13+
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN 'WITH(FORCE)' ELSE '' END AS "DROPDBOPTION" \gset
DROP DATABASE :TEST_DBNAME_EXTRA :DROPDBOPTION;

View File

@ -217,4 +217,8 @@ INSERT INTO test_tz VALUES('Mon Mar 20 09:37:00.936242 2017', 30, 'dev3');
SELECT * FROM test_tz ORDER BY time;
\c :TEST_DBNAME :ROLE_SUPERUSER
DROP DATABASE :TEST_DBNAME_EXTRA;
-- DROP DATABASE WITH(FORCE) is only available in PG13+
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN 'WITH(FORCE)' ELSE '' END AS "DROPDBOPTION" \gset
DROP DATABASE :TEST_DBNAME_EXTRA :DROPDBOPTION;