|
13 | 13 | * |
14 | 14 | * |
15 | 15 | * IDENTIFICATION |
16 | | - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.364 2008/02/11 19:14:30 tgl Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.365 2008/02/20 14:31:35 alvherre Exp $ |
17 | 17 | * |
18 | 18 | *------------------------------------------------------------------------- |
19 | 19 | */ |
|
30 | 30 | #include "access/xlog.h" |
31 | 31 | #include "catalog/namespace.h" |
32 | 32 | #include "catalog/pg_database.h" |
| 33 | +#include "catalog/pg_namespace.h" |
33 | 34 | #include "commands/dbcommands.h" |
34 | 35 | #include "commands/vacuum.h" |
35 | 36 | #include "executor/executor.h" |
@@ -1048,9 +1049,18 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) |
1048 | 1049 | if (!(pg_class_ownercheck(RelationGetRelid(onerel), GetUserId()) || |
1049 | 1050 | (pg_database_ownercheck(MyDatabaseId, GetUserId()) && !onerel->rd_rel->relisshared))) |
1050 | 1051 | { |
1051 | | - ereport(WARNING, |
1052 | | - (errmsg("skipping \"%s\" --- only table or database owner can vacuum it", |
1053 | | - RelationGetRelationName(onerel)))); |
| 1052 | + if (onerel->rd_rel->relisshared) |
| 1053 | + ereport(WARNING, |
| 1054 | + (errmsg("skipping \"%s\" --- only superuser can vacuum it", |
| 1055 | + RelationGetRelationName(onerel)))); |
| 1056 | + else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE) |
| 1057 | + ereport(WARNING, |
| 1058 | + (errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it", |
| 1059 | + RelationGetRelationName(onerel)))); |
| 1060 | + else |
| 1061 | + ereport(WARNING, |
| 1062 | + (errmsg("skipping \"%s\" --- only table or database owner can vacuum it", |
| 1063 | + RelationGetRelationName(onerel)))); |
1054 | 1064 | relation_close(onerel, lmode); |
1055 | 1065 | CommitTransactionCommand(); |
1056 | 1066 | return; |
|
0 commit comments