8000 Add regression tests for VACUUM and ANALYZE with relation skips · postgres/postgres@98abc73 · GitHub
[go: up one dir, main page]

Skip to content

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/test/regress/expected/vacuum.out

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,31 @@ LINE 1: ANALYZE (nonexistant-arg) does_not_exist;
122122
DROP TABLE vaccluster;
123123
DROP TABLE vactst;
124124
DROP TABLE vacparted;
125+
-- relation ownership, WARNING logs generated as all are skipped.
126+
CREATE TABLE vacowned (a int);
127+
CREATE ROLE regress_vacuum;
128+
SET ROLE regress_vacuum;
129+
-- Simple table
130+
VACUUM vacowned;
131+
WARNING: skipping "vacowned" --- only table or database owner can vacuum it
132+
ANALYZE vacowned;
133+
WARNING: skipping "vacowned" --- only table or database owner can analyze it
134+
VACUUM (ANALYZE) vacowned;
135+
WARNING: skipping "vacowned" --- only table or database owner can vacuum it
136+
-- Catalog
137+
VACUUM pg_catalog.pg_class;
138+
WARNING: skipping "pg_class" --- only superuser or database owner can vacuum it
139+
ANALYZE pg_catalog.pg_class;
140+
WARNING: skipping "pg_class" --- only superuser or database owner can analyze it
141+
VACUUM (ANALYZE) pg_catalog.pg_class;
142+
WARNING: skipping "pg_class" --- only superuser or database owner can vacuum it
143+
-- Shared catalog
144+
VACUUM pg_catalog.pg_authid;
145+
WARNING: skipping "pg_authid" --- only superuser can vacuum it
146+
ANALYZE pg_catalog.pg_authid;
147+
WARNING: skipping "pg_authid" --- only superuser can analyze it
148+
VACUUM (ANALYZE) pg_catalog.pg_authid;
149+
WARNING: skipping "pg_authid" --- only superuser can vacuum it
150+
RESET ROLE;
151+
DROP TABLE vacowned;
152+
DROP ROLE regress_vacuum;

src/test/regress/sql/vacuum.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,23 @@ ANALYZE (nonexistant-arg) does_not_exist;
9696
DROP TABLE vaccluster;
9797
DROP TABLE vactst;
9898
DROP TABLE vacparted;
99+
100+
-- relation ownership, WARNING logs generated as all are skipped.
101+
CREATE TABLE vacowned (a int);
102+
CREATE ROLE regress_vacuum;
103+
SET ROLE regress_vacuum;
104+
-- Simple table
105+
VACUUM vacowned;
106+
ANALYZE vacowned;
107+
VACUUM (ANALYZE) vacowned;
108+
-- Catalog
109+
VACUUM pg_catalog.pg_class;
110+
ANALYZE pg_catalog.pg_class;
111+
VACUUM (ANALYZE) pg_catalog.pg_class;
112+
-- Shared catalog
113+
VACUUM pg_catalog.pg_authid;
114+
ANALYZE pg_catalog.pg_authid;
115+
VACUUM (ANALYZE) pg_catalog.pg_authid;
116+
RESET ROLE;
117+
DROP TABLE vacowned;
118+
DROP ROLE regress_vacuum;

0 commit comments

Comments
 (0)
0