diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index c9be71ef60..45e69573ce 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -119,9 +119,21 @@ ANALYZE (nonexistant-arg) does_not_exist; ERROR: syntax error at or near "nonexistant" LINE 1: ANALYZE (nonexistant-arg) does_not_exist; ^ +-- permission checks in vacuum_rel() and analyze_rel() +CREATE ROLE vacparted_owner; +ALTER TABLE vacparted OWNER TO vacparted_owner; +SET ROLE vacparted_owner; +VACUUM vacparted; +WARNING: skipping "vacparted1" --- only table or database owner can vacuum it +ANALYZE vacparted; +WARNING: skipping "vacparted1" --- only table or database owner can analyze it +VACUUM (ANALYZE) vacparted; +WARNING: skipping "vacparted1" --- only table or database owner can vacuum it +RESET ROLE; DROP TABLE vaccluster; DROP TABLE vactst; DROP TABLE vacparted; +DROP ROLE vacparted_owner; -- relation ownership, WARNING logs generated as all are skipped. CREATE TABLE vacowned (a int); CREATE ROLE regress_vacuum; diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql index 0feff7c413..9e4d081da9 100644 --- a/src/test/regress/sql/vacuum.sql +++ b/src/test/regress/sql/vacuum.sql @@ -93,9 +93,19 @@ ANALYZE vactst (i), vacparted (does_not_exist); ANALYZE (VERBOSE) does_not_exist; ANALYZE (nonexistant-arg) does_not_exist; +-- permission checks in vacuum_rel() and analyze_rel() +CREATE ROLE vacparted_owner; +ALTER TABLE vacparted OWNER TO vacparted_owner; +SET ROLE vacparted_owner; +VACUUM vacparted; +ANALYZE vacparted; +VACUUM (ANALYZE) vacparted; +RESET ROLE; + DROP TABLE vaccluster; DROP TABLE vactst; DROP TABLE vacparted; +DROP ROLE vacparted_owner; -- relation ownership, WARNING logs generated as all are skipped. CREATE TABLE vacowned (a int);