Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98abc73

Browse files
committed
Add regression tests for VACUUM and ANALYZE with relation skips
When a user does not have ownership on a relation, then specific logmessages are generated. This new test suite adds coverage for all thepossible log messages generated, which will be useful to check theconsistency of any refactoring related to ownership checks for relationsvacuumed or analyzed.Author: Michael PaquierReviewed-by: Nathan BossartDiscussion:https://postgr.es/m/20180812222142.GA6097@paquier.xyz
1 parent55a0154 commit98abc73

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
DROPTABLE vaccluster;
9797
DROPTABLE vactst;
9898
DROPTABLE vacparted;
99+
100+
-- relation ownership, WARNING logs generated as all are skipped.
101+
CREATETABLEvacowned (aint);
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+
VACUUMpg_catalog.pg_class;
110+
ANALYZEpg_catalog.pg_class;
111+
VACUUM (ANALYZE)pg_catalog.pg_class;
112+
-- Shared catalog
113+
VACUUMpg_catalog.pg_authid;
114+
ANALYZEpg_catalog.pg_authid;
115+
VACUUM (ANALYZE)pg_catalog.pg_authid;
116+
RESET ROLE;
117+
DROPTABLE vacowned;
118+
DROP ROLE regress_vacuum;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp