summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2017-08-01 20:49:23 +0000
committerTom Lane2017-08-01 20:49:23 +0000
commit8e7537261c4b7d296fc10513b93bd67dc3d415b0 (patch)
tree36349bcce6b8a8012af3684564d84df97ef49b74
parent1e165d05fe06a9072867607886f818bc255507db (diff)
Suppress less info in regression tests using DROP CASCADE.
DROP CASCADE doesn't currently promise to visit dependent objects in a fixed order, so when the regression tests use it, we typically need to suppress the details of which objects get dropped in order to have predictable test output. Traditionally we've done that by setting client_min_messages higher than NOTICE, but there's a better way: we can "\set VERBOSITY terse" in psql. That suppresses the DETAIL message with the object list, but we still get the basic notice telling how many objects were dropped. So at least the test case can verify that the expected number of objects were dropped. The VERBOSITY method was already in use in a few places, but run around and use it wherever it makes sense. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/test/regress/expected/alter_generic.out6
-rw-r--r--src/test/regress/expected/create_index.out4
-rw-r--r--src/test/regress/expected/create_view.out4
-rw-r--r--src/test/regress/expected/object_address.out4
-rw-r--r--src/test/regress/expected/privileges.out9
-rw-r--r--src/test/regress/expected/rowsecurity.out18
-rw-r--r--src/test/regress/expected/rules.out5
-rw-r--r--src/test/regress/expected/stats_ext.out6
-rw-r--r--src/test/regress/expected/typed_table.out4
-rw-r--r--src/test/regress/sql/alter_generic.sql2
-rw-r--r--src/test/regress/sql/create_index.sql3
-rw-r--r--src/test/regress/sql/create_view.sql2
-rw-r--r--src/test/regress/sql/object_address.sql2
-rw-r--r--src/test/regress/sql/privileges.sql8
-rw-r--r--src/test/regress/sql/rowsecurity.sql16
-rw-r--r--src/test/regress/sql/rules.sql4
-rw-r--r--src/test/regress/sql/stats_ext.sql4
-rw-r--r--src/test/regress/sql/typed_table.sql7
18 files changed, 52 insertions, 56 deletions
diff --git a/src/test/regress/expected/alter_generic.out b/src/test/regress/expected/alter_generic.out
index 62347bc47e..9f6ad4de33 100644
--- a/src/test/regress/expected/alter_generic.out
+++ b/src/test/regress/expected/alter_generic.out
@@ -673,13 +673,17 @@ SELECT nspname, prsname
---
--- Cleanup resources
---
-set client_min_messages to warning; -- suppress cascade notices
+\set VERBOSITY terse \\ -- suppress cascade details
DROP FOREIGN DATA WRAPPER alt_fdw2 CASCADE;
+NOTICE: drop cascades to server alt_fserv2
DROP FOREIGN DATA WRAPPER alt_fdw3 CASCADE;
+NOTICE: drop cascades to server alt_fserv3
DROP LANGUAGE alt_lang2 CASCADE;
DROP LANGUAGE alt_lang3 CASCADE;
DROP SCHEMA alt_nsp1 CASCADE;
+NOTICE: drop cascades to 28 other objects
DROP SCHEMA alt_nsp2 CASCADE;
+NOTICE: drop cascades to 9 other objects
DROP USER regress_alter_user1;
DROP USER regress_alter_user2;
DROP USER regress_alter_user3;
diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out
index 26cd05933c..064adb4640 100644
--- a/src/test/regress/expected/create_index.out
+++ b/src/test/regress/expected/create_index.out
@@ -3064,6 +3064,6 @@ ERROR: must be owner of schema schema_to_reindex
-- Clean up
RESET ROLE;
DROP ROLE regress_reindexuser;
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA schema_to_reindex CASCADE;
-RESET client_min_messages;
+NOTICE: drop cascades to 6 other objects
diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.out
index 34f0b7641d..f909a3cefe 100644
--- a/src/test/regress/expected/create_view.out
+++ b/src/test/regress/expected/create_view.out
@@ -1707,6 +1707,8 @@ select pg_get_ruledef(oid, true) from pg_rewrite
(1 row)
-- clean up all the random objects we made above
-set client_min_messages = warning;
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA temp_view_test CASCADE;
+NOTICE: drop cascades to 27 other objects
DROP SCHEMA testviewschm2 CASCADE;
+NOTICE: drop cascades to 62 other objects
diff --git a/src/test/regress/expected/object_address.out b/src/test/regress/expected/object_address.out
index 3f23a48972..1fdadbc9ef 100644
--- a/src/test/regress/expected/object_address.out
+++ b/src/test/regress/expected/object_address.out
@@ -474,10 +474,12 @@ SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
---
--- Cleanup resources
---
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP FOREIGN DATA WRAPPER addr_fdw CASCADE;
+NOTICE: drop cascades to 4 other objects
DROP PUBLICATION addr_pub;
DROP SUBSCRIPTION addr_sub;
DROP SCHEMA addr_nsp CASCADE;
+NOTICE: drop cascades to 12 other objects
DROP OWNED BY regress_addr_user;
DROP USER regress_addr_user;
diff --git a/src/test/regress/expected/privileges.out b/src/test/regress/expected/privileges.out
index 3262aa1d10..da37c4faed 100644
--- a/src/test/regress/expected/privileges.out
+++ b/src/test/regress/expected/privileges.out
@@ -1620,9 +1620,10 @@ SELECT has_function_privilege('regress_user1', 'testns.testfunc(int)', 'EXECUTE'
f
(1 row)
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA testns CASCADE;
-RESET client_min_messages;
+NOTICE: drop cascades to 3 other objects
+\set VERBOSITY default
-- Change owner of the schema & and rename of new schema owner
\c -
CREATE ROLE regress_schemauser1 superuser login;
@@ -1644,9 +1645,9 @@ SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname =
(1 row)
set session role regress_schemauser_renamed;
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA testns CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
-- clean up
\c -
DROP ROLE regress_schemauser1;
diff --git a/src/test/regress/expected/rowsecurity.out b/src/test/regress/expected/rowsecurity.out
index 26d28f248b..de2ee4d2c9 100644
--- a/src/test/regress/expected/rowsecurity.out
+++ b/src/test/regress/expected/rowsecurity.out
@@ -1393,10 +1393,10 @@ ERROR: infinite recursion detected in policy for relation "rec1"
-- Mutual recursion via .s.b views
--
SET SESSION AUTHORIZATION regress_rls_bob;
--- Suppress NOTICE messages when doing a cascaded drop.
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP VIEW rec1v, rec2v CASCADE;
-RESET client_min_messages;
+NOTICE: drop cascades to 2 other objects
+\set VERBOSITY default
CREATE VIEW rec1v WITH (security_barrier) AS SELECT * FROM rec1;
CREATE VIEW rec2v WITH (security_barrier) AS SELECT * FROM rec2;
SET SESSION AUTHORIZATION regress_rls_alice;
@@ -2775,10 +2775,10 @@ DROP TABLE test_qual_pushdown;
-- Plancache invalidate on user change.
--
RESET SESSION AUTHORIZATION;
--- Suppress NOTICE messages when doing a cascaded drop.
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP TABLE t1 CASCADE;
-RESET client_min_messages;
+NOTICE: drop cascades to 2 other objects
+\set VERBOSITY default
CREATE TABLE t1 (a integer);
GRANT SELECT ON t1 TO regress_rls_bob, regress_rls_carol;
CREATE POLICY p1 ON t1 TO regress_rls_bob USING ((a % 2) = 0);
@@ -3902,10 +3902,10 @@ DROP USER regress_rls_dob_role2;
-- Clean up objects
--
RESET SESSION AUTHORIZATION;
--- Suppress NOTICE messages when doing a cascaded drop.
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA regress_rls_schema CASCADE;
-RESET client_min_messages;
+NOTICE: drop cascades to 29 other objects
+\set VERBOSITY default
DROP USER regress_rls_alice;
DROP USER regress_rls_bob;
DROP USER regress_rls_carol;
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index 2e42b9ec05..05adfa2376 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -2622,9 +2622,10 @@ select * from id_ordered;
6 | Test 6
(6 rows)
-set client_min_messages to warning; -- suppress cascade notices
+\set VERBOSITY terse \\ -- suppress cascade details
drop table id cascade;
-reset client_min_messages;
+NOTICE: drop cascades to 4 other objects
+\set VERBOSITY default
--
-- check corner case where an entirely-dummy subplan is created by
-- constraint exclusion
diff --git a/src/test/regress/expected/stats_ext.out b/src/test/regress/expected/stats_ext.out
index 085dce7fd7..441cfaa411 100644
--- a/src/test/regress/expected/stats_ext.out
+++ b/src/test/regress/expected/stats_ext.out
@@ -122,10 +122,12 @@ EXCEPTION WHEN wrong_object_type THEN
END;
$$;
NOTICE: stats on toast table not created
-SET client_min_messages TO warning;
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA tststats CASCADE;
+NOTICE: drop cascades to 7 other objects
DROP FOREIGN DATA WRAPPER extstats_dummy_fdw CASCADE;
-RESET client_min_messages;
+NOTICE: drop cascades to server extstats_dummy_srv
+\set VERBOSITY default
-- n-distinct tests
CREATE TABLE ndistinct (
filler1 TEXT,
diff --git a/src/test/regress/expected/typed_table.out b/src/test/regress/expected/typed_table.out
index 5cdd019244..2e47ecbcf5 100644
--- a/src/test/regress/expected/typed_table.out
+++ b/src/test/regress/expected/typed_table.out
@@ -1,7 +1,3 @@
--- Clean up in case a prior regression run failed
-SET client_min_messages TO 'warning';
-DROP TYPE IF EXISTS person_type CASCADE;
-RESET client_min_messages;
CREATE TABLE ttable1 OF nothing;
ERROR: type "nothing" does not exist
CREATE TYPE person_type AS (id int, name text);
diff --git a/src/test/regress/sql/alter_generic.sql b/src/test/regress/sql/alter_generic.sql
index 342f82856e..311812e351 100644
--- a/src/test/regress/sql/alter_generic.sql
+++ b/src/test/regress/sql/alter_generic.sql
@@ -573,7 +573,7 @@ SELECT nspname, prsname
---
--- Cleanup resources
---
-set client_min_messages to warning; -- suppress cascade notices
+\set VERBOSITY terse \\ -- suppress cascade details
DROP FOREIGN DATA WRAPPER alt_fdw2 CASCADE;
DROP FOREIGN DATA WRAPPER alt_fdw3 CASCADE;
diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql
index 1648072568..67470db918 100644
--- a/src/test/regress/sql/create_index.sql
+++ b/src/test/regress/sql/create_index.sql
@@ -1083,6 +1083,5 @@ REINDEX SCHEMA schema_to_reindex;
-- Clean up
RESET ROLE;
DROP ROLE regress_reindexuser;
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA schema_to_reindex CASCADE;
-RESET client_min_messages;
diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/create_view.sql
index 04941671dd..b4e7a8793c 100644
--- a/src/test/regress/sql/create_view.sql
+++ b/src/test/regress/sql/create_view.sql
@@ -581,6 +581,6 @@ select pg_get_ruledef(oid, true) from pg_rewrite
where ev_class = 'tt23v'::regclass and ev_type = '1';
-- clean up all the random objects we made above
-set client_min_messages = warning;
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA temp_view_test CASCADE;
DROP SCHEMA testviewschm2 CASCADE;
diff --git a/src/test/regress/sql/object_address.sql b/src/test/regress/sql/object_address.sql
index ca7ed46e41..63821b8008 100644
--- a/src/test/regress/sql/object_address.sql
+++ b/src/test/regress/sql/object_address.sql
@@ -201,7 +201,7 @@ SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
---
--- Cleanup resources
---
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP FOREIGN DATA WRAPPER addr_fdw CASCADE;
DROP PUBLICATION addr_pub;
diff --git a/src/test/regress/sql/privileges.sql b/src/test/regress/sql/privileges.sql
index fe83709e1b..5bc47bcd13 100644
--- a/src/test/regress/sql/privileges.sql
+++ b/src/test/regress/sql/privileges.sql
@@ -981,9 +981,9 @@ REVOKE ALL ON ALL FUNCTIONS IN SCHEMA testns FROM PUBLIC;
SELECT has_function_privilege('regress_user1', 'testns.testfunc(int)', 'EXECUTE'); -- false
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA testns CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
-- Change owner of the schema & and rename of new schema owner
@@ -1002,9 +1002,9 @@ ALTER ROLE regress_schemauser2 RENAME TO regress_schemauser_renamed;
SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid;
set session role regress_schemauser_renamed;
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA testns CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
-- clean up
\c -
diff --git a/src/test/regress/sql/rowsecurity.sql b/src/test/regress/sql/rowsecurity.sql
index ba8fed40f5..e03a7ab65f 100644
--- a/src/test/regress/sql/rowsecurity.sql
+++ b/src/test/regress/sql/rowsecurity.sql
@@ -517,11 +517,10 @@ SELECT * FROM rec1; -- fail, mutual recursion via views
-- Mutual recursion via .s.b views
--
SET SESSION AUTHORIZATION regress_rls_bob;
--- Suppress NOTICE messages when doing a cascaded drop.
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP VIEW rec1v, rec2v CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
CREATE VIEW rec1v WITH (security_barrier) AS SELECT * FROM rec1;
CREATE VIEW rec2v WITH (security_barrier) AS SELECT * FROM rec2;
@@ -1026,11 +1025,10 @@ DROP TABLE test_qual_pushdown;
-- Plancache invalidate on user change.
--
RESET SESSION AUTHORIZATION;
--- Suppress NOTICE messages when doing a cascaded drop.
-SET client_min_messages TO 'warning';
+\set VERBOSITY terse \\ -- suppress cascade details
DROP TABLE t1 CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
CREATE TABLE t1 (a integer);
@@ -1762,11 +1760,9 @@ DROP USER regress_rls_dob_role2;
--
RESET SESSION AUTHORIZATION;
--- Suppress NOTICE messages when doing a cascaded drop.
-SET client_min_messages TO 'warning';
-
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA regress_rls_schema CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
DROP USER regress_rls_alice;
DROP USER regress_rls_bob;
diff --git a/src/test/regress/sql/rules.sql b/src/test/regress/sql/rules.sql
index 38751bb881..0ded0f01d2 100644
--- a/src/test/regress/sql/rules.sql
+++ b/src/test/regress/sql/rules.sql
@@ -936,9 +936,9 @@ update id_ordered set name = 'update 4' where id = 4;
update id_ordered set name = 'update 5' where id = 5;
select * from id_ordered;
-set client_min_messages to warning; -- suppress cascade notices
+\set VERBOSITY terse \\ -- suppress cascade details
drop table id cascade;
-reset client_min_messages;
+\set VERBOSITY default
--
-- check corner case where an entirely-dummy subplan is created by
diff --git a/src/test/regress/sql/stats_ext.sql b/src/test/regress/sql/stats_ext.sql
index d1ff3a8583..46acaadb39 100644
--- a/src/test/regress/sql/stats_ext.sql
+++ b/src/test/regress/sql/stats_ext.sql
@@ -89,10 +89,10 @@ EXCEPTION WHEN wrong_object_type THEN
END;
$$;
-SET client_min_messages TO warning;
+\set VERBOSITY terse \\ -- suppress cascade details
DROP SCHEMA tststats CASCADE;
DROP FOREIGN DATA WRAPPER extstats_dummy_fdw CASCADE;
-RESET client_min_messages;
+\set VERBOSITY default
-- n-distinct tests
CREATE TABLE ndistinct (
diff --git a/src/test/regress/sql/typed_table.sql b/src/test/regress/sql/typed_table.sql
index 1cdceef363..9ef0cdfcc7 100644
--- a/src/test/regress/sql/typed_table.sql
+++ b/src/test/regress/sql/typed_table.sql
@@ -1,10 +1,3 @@
--- Clean up in case a prior regression run failed
-SET client_min_messages TO 'warning';
-
-DROP TYPE IF EXISTS person_type CASCADE;
-
-RESET client_min_messages;
-
CREATE TABLE ttable1 OF nothing;
CREATE TYPE person_type AS (id int, name text);