mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add regression tests for VACUUM and ANALYZE with relation skips
When a user does not have ownership on a relation, then specific log messages are generated. This new test suite adds coverage for all the possible log messages generated, which will be useful to check the consistency of any refactoring related to ownership checks for relations vacuumed or analyzed. Author: Michael Paquier Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/20180812222142.GA6097@paquier.xyz
This commit is contained in:
@ -122,3 +122,31 @@ LINE 1: ANALYZE (nonexistant-arg) does_not_exist;
|
||||
DROP TABLE vaccluster;
|
||||
DROP TABLE vactst;
|
||||
DROP TABLE vacparted;
|
||||
-- relation ownership, WARNING logs generated as all are skipped.
|
||||
CREATE TABLE vacowned (a int);
|
||||
CREATE ROLE regress_vacuum;
|
||||
SET ROLE regress_vacuum;
|
||||
-- Simple table
|
||||
VACUUM vacowned;
|
||||
WARNING: skipping "vacowned" --- only table or database owner can vacuum it
|
||||
ANALYZE vacowned;
|
||||
WARNING: skipping "vacowned" --- only table or database owner can analyze it
|
||||
VACUUM (ANALYZE) vacowned;
|
||||
WARNING: skipping "vacowned" --- only table or database owner can vacuum it
|
||||
-- Catalog
|
||||
VACUUM pg_catalog.pg_class;
|
||||
WARNING: skipping "pg_class" --- only superuser or database owner can vacuum it
|
||||
ANALYZE pg_catalog.pg_class;
|
||||
WARNING: skipping "pg_class" --- only superuser or database owner can analyze it
|
||||
VACUUM (ANALYZE) pg_catalog.pg_class;
|
||||
WARNING: skipping "pg_class" --- only superuser or database owner can vacuum it
|
||||
-- Shared catalog
|
||||
VACUUM pg_catalog.pg_authid;
|
||||
WARNING: skipping "pg_authid" --- only superuser can vacuum it
|
||||
ANALYZE pg_catalog.pg_authid;
|
||||
WARNING: skipping "pg_authid" --- only superuser can analyze it
|
||||
VACUUM (ANALYZE) pg_catalog.pg_authid;
|
||||
WARNING: skipping "pg_authid" --- only superuser can vacuum it
|
||||
RESET ROLE;
|
||||
DROP TABLE vacowned;
|
||||
DROP ROLE regress_vacuum;
|
||||
|
@ -96,3 +96,23 @@ ANALYZE (nonexistant-arg) does_not_exist;
|
||||
DROP TABLE vaccluster;
|
||||
DROP TABLE vactst;
|
||||
DROP TABLE vacparted;
|
||||
|
||||
-- relation ownership, WARNING logs generated as all are skipped.
|
||||
CREATE TABLE vacowned (a int);
|
||||
CREATE ROLE regress_vacuum;
|
||||
SET ROLE regress_vacuum;
|
||||
-- Simple table
|
||||
VACUUM vacowned;
|
||||
ANALYZE vacowned;
|
||||
VACUUM (ANALYZE) vacowned;
|
||||
-- Catalog
|
||||
VACUUM pg_catalog.pg_class;
|
||||
ANALYZE pg_catalog.pg_class;
|
||||
VACUUM (ANALYZE) pg_catalog.pg_class;
|
||||
-- Shared catalog
|
||||
VACUUM pg_catalog.pg_authid;
|
||||
ANALYZE pg_catalog.pg_authid;
|
||||
VACUUM (ANALYZE) pg_catalog.pg_authid;
|
||||
RESET ROLE;
|
||||
DROP TABLE vacowned;
|
||||
DROP ROLE regress_vacuum;
|
||||
|
Reference in New Issue
Block a user